Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take indexed argument into account when using ElasticSearchAdapter #160

Open
fnordo opened this issue Sep 27, 2021 · 0 comments
Open

Take indexed argument into account when using ElasticSearchAdapter #160

fnordo opened this issue Sep 27, 2021 · 0 comments
Labels

Comments

@fnordo
Copy link

fnordo commented Sep 27, 2021

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.

@luca-rath luca-rath added the bug label Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants