Varun Thacker created SOLR-6648:
-----------------------------------

             Summary: AnalyzingInfixLookupFactory always highlights suggestions
                 Key: SOLR-6648
                 URL: https://issues.apache.org/jira/browse/SOLR-6648
             Project: Solr
          Issue Type: Bug
    Affects Versions: 4.10.1, 4.10, 4.9.1, 4.9
            Reporter: Varun Thacker
             Fix For: 5.0, Trunk


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
{code}
<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>
{code}

solrconfig changes -

{code}
<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"/>
{code}

Add 3 documents - 

{code}
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"} ]
'
{code}

Query -

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

Response 
{code}
{
  "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":""}]}}}}
{code}

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?





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to