The following query does a sorted fuzzy search in SOLR 9.3
{!type=complexphrase inOrder=true}Appfel~1
where
Parameter | Meaning |
---|---|
{! } |
Local query parameter referred in SOLR documentation as LocalParams |
type=complexphrase |
Use ComplexPhraseQParser |
inOrder=true |
How the query should be handled |
~1 |
Use fuzzy search of edit distance 1 |
and delivers desired results - german words similar to Apfel. So far so good.
What I would like to achieve is to move the configuration from query string into the SOLR backend (for instance into solrconfig.xml), so that the client does not need to know anything about SOLR specific logic. My goal is to let the client search with
q=Appfel
which SOLR server translates into:
{!type=complexphrase inOrder=true}Appfel~1
A solution for the first part with ComplexPhraseQParser I could find:
<requestHandler name="/suggest" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">complexphrase</str>
<str name="df">myField</str>
<str name="inOrder">true</str>
...
</lst>
</requestHandler>
but for the FUZZY operand I cannot find a way to set it as a default for all queries. I've tried
<requestHandler name="/suggest" class="solr.SearchHandler">
<lst name="defaults">
...
<str name="q.op">FUZZY</str>
...
</requestHandler>
without any success. I've found the QParserPlugin - but before I will code a new subclass, I would like to ask in this forum first.
How to configure "~1" for all queries by default in the SOLR server configuration?
The same question for SOLR 5 - without a solution.