hettler
(Daniel H.)
September 28, 2023, 1:09pm
1
Hello everyone,
I’m trying to adapt the handling of the search terms form the default OR
to an AND
connection but I only find examples like this (OR):
searchTerm = ${request.arguments.search}
searchQuery = ${this.searchTerm ? Search.query(site).simpleQueryStringFulltext(this.searchTerm, {'analyzer': 'synonym_analyzer'}).nodeType('Neos.Neos:Document').queryFilter('bool', this.queryFilter) : null}
I’m using GitHub - Flowpack/Flowpack.SearchPlugin: A simple search plugin for Neos and GitHub - Flowpack/Flowpack.ElasticSearch.ContentRepositoryAdaptor: Flowpack.ElasticSearch adapter to support the Neos Content Repository .
Can somebody give an hint?
Thanks in advance!
leif
(Leif Hartmann)
October 23, 2023, 11:28am
2
Hi Daniel,
the easiest way I found was to change the default query parameters of the ElasticSearch query. This should however effect all full text queries. If that’s no trouble for you, you can change it with the following settings parameter:
Flowpack:
ElasticSearch:
ContentRepositoryAdaptor:
driver:
mapping:
6.x:
query:
arguments:
queryStringParameters:
default_operator: and
If you use driver version 6.x (7.x is an alias for 6.x).
You can show your current configuration using the command line, i.e.:
./flow configuration:show --path Flowpack.ElasticSearch.ContentRepositoryAdaptor.driver
If you do not want to set the default operator globally, you might be able to change it with the ElasticSearchQueryBuilder->appendAtPath()
method.
Regards
Leif
1 Like