Details
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
Attachments
Issue Links
- requires
-
LUCENE-6149 Infix suggesters' highlighting, allTermsRequired options are hardwired and not configurable for non-contextual lookup
-
- Closed
-