2

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>
James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

1

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.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • Thanks for the response. Now I am getting some response atleast but the suggestor is not working using these two lookupImpl. I am getting the exact term in return as response rather than suggestions for that term. Do you have any idea why its happening? – Shashank Srivastava Oct 09 '18 at 06:58
  • That would depend on the analysis performed for the field and what's stored in the index. Also make sure that the field is set to stored, and check the possible options for the chosen LookupFactory in the reference manual. – MatsLindh Oct 09 '18 at 07:37
  • The field on which I want to apply context filter is a multi valued field. Can we put multi value field as contextField? If yes do you know any way of doing it. Please help! – Shashank Srivastava Oct 10 '18 at 05:43