SuggestorComponent with contextFilter in solr

431 views Asked by At

Which lookup should i use for implementing context Filtering in solr Suggestor component?

I am trying to use contextFiler in FuzzyLookupFactory and AnalyzingLookupFactory but it is throwing me the below error:

Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/categories: this suggester doesn't support contexts.

My suggestor:

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
        <str name="name">displaySuggester</str>
        <str name="lookupImpl">FuzzyLookupFactory</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">autoComplete</str>
        <str name="contextField">productCategory</str>
        <str name="suggestAnalyzerFieldType">string</str>
        <str name="buildOnStartup">false</str>
    </lst>
</searchComponent>
1

There are 1 answers

3
MatsLindh On BEST ANSWER

The reference manual has the required settings:

Context filtering lets you filter suggestions by a separate context field, such as category, department or any other token. The AnalyzingInfixLookupFactory and BlendedInfixLookupFactory currently support this feature, when backed by DocumentDictionaryFactory.

It's important to note that this is the Analyzing**Infix**LookupFactory, and not the AnalyzingLookupFactory.

You're already using the DocumentDictionaryFactory, so switch to either the AnalyzingInfixLookupFactory or the BlendedInfixLookupFactory to make it work.