Reputation: 1516
In the docs, it says that context filtering only comes into effect "when using AnalyzingInfixLookupFactory
or BlendedInfixLookupFactory
, when backed by a DocumentDictionaryFactory
".
However, I have found that the context filtering is applied when a FileDictionaryFactory
is used. This doesn't work, as there are no documents for the context filter to be applied to.
http://localhost:8983/solr/mycore/suggest?qt=suggest&suggest.dictionary=location&q=russia
> Returns ["Russia"]
http://localhost:8983/solr/mycore/suggest?qt=suggest&suggest.dictionary=location&q=russia&cfq=a
> Returns []
This is my suggester config:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">location</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">FileDictionaryFactory</str>
<str name="sourceLocation">tdwg.txt</str>
<str name="suggestAnalyzerFieldType">text_general</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">common-name</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">region.vernacular_names_t</str>
<str name="indexPath">common_name_suggest</str>
<str name="contextField">searchable.context_ss</str>
<str name="suggestAnalyzerFieldType">text_general</str>
<str name="highlight">false</str>
</lst>
</searchComponent>
As you can see, for one of the suggesters I do want context filtering (and it is working correctly). So I can't simply remove the suggest.cfq
parameter from my request.
Is there anything I can change about my configuration so that the context filter is not applied to my FileDictionaryFactory
suggester?
Upvotes: 3
Views: 328
Reputation: 16035
I already faced this issue in the past, it appears that when suggest.cfq
is present in the request, context filtering will be applied for every (enabled) lookup implementations that supports it (AnalyzingInfix and BlendedInfix).
It seems there is no other solution than switching to another lookup impl. than these 2 for the dictionary which you don't want to apply context filtering.
For example you can try to use the FuzzyLookupFactory
for the "location" suggester and the context filter won't be applied.
NB: this is a workaround, as it's not possible to get infix matches with FuzzyLookup or AnalyzingLookup implementations (only the whole prefix from the input token(s) is taken into account).
If you really need infix matches for both suggesters, it's likely you will have to make 2 parallel requests before merging the suggestions :/.
Upvotes: 1