Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Unable to remove a date from index #203

@lozcalver

Description

@lozcalver

Given an index which includes a date (haven’t tested addFulltextField instead of addFilterField, but I suspect it’s the same):

<?php

namespace App\Indexes;

use App\Model\Documents\Document;
use Firesphere\SolrSearch\Indexes\BaseIndex;

class DocumentIndex extends BaseIndex
{
    public function init()
    {
        $this->addClass(Document::class);
        $this->addFulltextField('Title');
        $this->addFulltextField('FileContent');
        $this->addFilterField('Embargo'); // Date
        $this->addFilterField('Expiry'); // Date
    }

    public function getIndexName()
    {
        return 'document';
    }
}

If you set a date against an object, it’s added to the index as expected. If you then remove that date (it’s set to NULL in the database), it’s not removed from the index.

DocumentFactory seems to explicitly filter out null values here:

if ($value === null) {
continue;
}
I’m not sure if there’s any reason why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions