Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-6660 Improve the usability for the new Suggester
  3. SOLR-6648

AnalyzingInfixLookupFactory always highlights suggestions

Attach filesAttach ScreenshotVotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.9, 4.9.1, 4.10, 4.10.1
    • Fix Version/s: 5.1, 6.0
    • Component/s: None
    • Labels:

      Description

      When using AnalyzingInfixLookupFactory suggestions always return with the match term as highlighted and 'allTermsRequired' is always set to true.

      We should be able to configure those.

      Steps to reproduce -

      schema additions

      <searchComponent name="suggest" class="solr.SuggestComponent">
          <lst name="suggester">
            <str name="name">mySuggester</str>
            <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str> 
            <str name="field">suggestField</str>
            <str name="weightField">weight</str>
            <str name="suggestAnalyzerFieldType">textSuggest</str>
          </lst>
        </searchComponent>
      
        <requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
          <lst name="defaults">
            <str name="suggest">true</str>
            <str name="suggest.count">10</str>
          </lst>
          <arr name="components">
            <str>suggest</str>
          </arr>
        </requestHandler>
      

      solrconfig changes -

      <fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
         <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StandardFilterFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
         </analyzer>
        </fieldType>
      
      
         <field name="suggestField" type="textSuggest" indexed="true" stored="true"/>
      

      Add 3 documents -

      curl http://localhost:8983/solr/update/json?commit=true -H 'Content-type:application/json' -d '
      [ {"id" : "1", "suggestField" : "bass fishing"}, {"id" : "2", "suggestField" : "sea bass"}, {"id" : "3", "suggestField" : "sea bass fishing"} ]
      '
      

      Query -

      http://localhost:8983/solr/collection1/suggest?suggest.build=true&suggest.dictionary=mySuggester&q=bass&wt=json&indent=on
      

      Response

      {
        "responseHeader":{
          "status":0,
          "QTime":25},
        "command":"build",
        "suggest":{"mySuggester":{
            "bass":{
              "numFound":3,
              "suggestions":[{
                  "term":"<b>bass</b> fishing",
                  "weight":0,
                  "payload":""},
                {
                  "term":"sea <b>bass</b>",
                  "weight":0,
                  "payload":""},
                {
                  "term":"sea <b>bass</b> fishing",
                  "weight":0,
                  "payload":""}]}}}}
      

      The problem is in SolrSuggester Line 200 where we say lookup.lookup()

      This constructor does not take allTermsRequired and doHighlight since it's only tuneable to AnalyzingInfixSuggester and not the other lookup implementations.

      If different Lookup implementations have different params as their constructors, these sort of issues will always keep happening. Maybe we should not keep it generic and do instanceof checks and set params accordingly?

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              tflobbe Tomas Eduardo Fernandez Lobbe
              Reporter:
              varun Varun Thacker

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment