Hi all,
I asked a question on StackOverflow
<https://stackoverflow.com/questions/66423970/solr-suggester-context-filter-incorrectly-applied-to-filedictionaryfactory>about
a problem I was having with the suggester module, but since then I have
looked into the source code of Solr, and I thinkit is a bug.
Essentially, context filtering is being applied to a suggester that is
backed by a FileDictionaryFactory. According to the docs, this should not
happen, and context filters should be ignored.
This is my 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>
I have tested this on the latest version of Solr (8.8.1).
The relevant bit of source code is here
<https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/spelling/suggest/SolrSuggester.java#L251>.
I would expect suggestions to be null, as the combination of
AnalyzingInfixLookupFactory and FileDictionaryFactor doesn't support
context filtering.
Is there anything I can do to fix this problem?
Thanks,
Joaquim