Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr suggester no results

Tags:

apache

solr

I want to use the Solr suggester component for city names. I have the following settings:

schema.xml

Field definition

<fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
  <analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

The field i want to apply the suggester on

<field name="city" type="string"  indexed="true" stored="false"/>

The copy field

<copyField source="city" dest="citySuggest"/>

The field

<field name="citySuggest" type="textSuggest" stored="false" indexed="true" />

solr-config.xml

<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
  <lst name="defaults">
    <str name="suggest">true</str>
    <str name="suggest.count">10</str>
    <str name="suggest.dictionary">mySuggester</str>
  </lst>
  <arr name="components">
    <str>suggest</str>
  </arr>
</requestHandler>



<searchComponent name="suggest" class="solr.SuggestComponent">
  <lst name="suggester">
    <str name="name">mySuggester</str>
    <str name="lookupImpl">FuzzyLookupFactory</str>      
    <str name="dictionaryImpl">DocumentDictionaryFactory</str>    
    <str name="field">citySuggest</str>
    <str name="suggestAnalyzerFieldType">string</str>
  </lst>
</searchComponent>

Then i run

http://localhost:8983/solr/company/suggest?suggest=true&suggest.dictionary=mySuggester&wt=json&suggest.q=Ath&suggest.build=true

to build the suggest component

Finally i run

   http://localhost:8983/solr/company/suggest?suggest=true&suggest.dictionary=mySuggester&wt=json&suggest.q=Ath

but i get an empty result set

{"responseHeader":{"status":0,"QTime":0},"suggest":{"mySuggester":{"Ath":{"numFound":0,"suggestions":[]}}}}

Are there any obvious mistakes? Any thoughts?

like image 964
Grigoris Avatar asked May 04 '16 14:05

Grigoris


1 Answers

Τry the following:

  1. In the field with name="citySuggest" set the attribute stored="true".
  2. Then rebuild the suggester.
like image 171
Spyros K Avatar answered Oct 22 '22 13:10

Spyros K