Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOLR suggester multiple field autocomplete

I have setuped suggester component for autocomplete for one field(it work fine), but I need it for multiple fields is this possible?

My solrconfig xml:

<searchComponent class="solr.SpellCheckComponent" name="suggest">
    <lst name="spellchecker">
      <str name="name">suggest</str>
      <str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
      <str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
      <str name="field">name</str>
      <float name="threshold">0.005</float>
      <str name="buildOnCommit">true</str>
    </lst>
  </searchComponent>
  <requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest">
    <lst name="defaults">
      <str name="spellcheck">true</str>
      <str name="spellcheck.dictionary">suggest</str>
      <str name="spellcheck.onlyMorePopular">true</str>
      <str name="spellcheck.count">10</str>
      <str name="spellcheck.collate">true</str>
    </lst>
    <arr name="components">
      <str>suggest</str>
    </arr>
  </requestHandler>
like image 300
vladimir Avatar asked Oct 10 '11 12:10

vladimir


1 Answers

User copyfields to combine multiple fields into single field and use that field in suggester -

Schema -

<copyField source="name" dest="spell" />
<copyField source="other_name" dest="spell" />

suggester -

<str name="field">spell</str>
like image 165
Jayendra Avatar answered Nov 16 '22 00:11

Jayendra