This question/answer dealt with a pretty similar topic, but I couldn't find the solution I was searching for. How to practially use a keywordanalyzer in azure-search?
Starting situation:
I created a resource with multiple indexes. One of these indexes contains a Collection(Edm.String) field. From this field i only want to get documents which exactly contain the search term. For example the field contains documents like these: "Hovercraft zero", "Hovercraft one", "Hovercraft two".
If the search term is "Hover" all three documents should be returned. If the search term is "craft zer" only the document "Hovercraft zero" should be returned. The document shouldn't get a higher score, the desired behaviour is that I only get the "Hovercraft zero" document as result.
Further information:
It is not possible to set the searchmode to all (like it was recommended in the question on the top) because I just want to set this behaviour for this specific field and not for all search queries. It also is not possible to let the responsibility on the user to enter the search term with quotes.
What I have tried so far:
- Use the keyword analyzer like it was described in the question on top: no success
- Use an indexanalyzer with specific token filters (ngram, lowercase) and a searchanalyzer as a keyword analyzer: no success
- Use Charfilters to manipulate the search term and manually set the quotes on the first and last position (craft zer -> "craft zer"). Like Yahnoosh explained in the question on top, the query parser processes the query string before the analyzers are applied. So: no success
Is there any solution for this issue? Or is there a other approach to achieve the desired behaviour?
Hopefully someone can help.
Thanks in advance!