Skip to content

Take indexed argument into account when using ElasticSearchAdapter #160

@fnordo

Description

@fnordo

In use with Sulu v2.3.3, i tried to add an additional, non-searchable field to an index by listening to the PreIndexEvent and adding the field manually using Massive\Bundle\SearchBundle\Search\Factory\Factory like so:

        $document->addField($this->factory->createField(
            'my_additional_field',
            $value,
            Field::TYPE_STRING,
            true,
            false
        ));

Although the $indexed-param of $factory::createField() is set to false, the additionally created field is still searchable within the index.

According to feedback on this topic in the Sulu Slack Channel, the root of the problem is to be found in ElasticSearchAdapter::prepareSearch(SearchQuery $searchQuery), as the query_string-array should contain an additional fields array containing the names of all fields where $indexed is true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions