You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sphene Software <sp...@gmail.com> on 2012/04/09 15:27:49 UTC

Multi Term TypeAhead with Solr Suggester

Folks,

I am trying to achieve following behavior with Typeahead feature with solr
suggester:

*Case 1: *User Types: bl    Expected Result: black rose
*Case 2: *User Types: ro    Expected Result: black rose

I can achieve *Case 1*  with the config below but not Case 2.


Config:
<fieldType name="text_auto" class="solr.TextField"
positionIncrementGap="100" omitNorms="true">
    <analyzer type="index">
      <tokenizer class="solr.KeywordTokenizerFactory"/>
      <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt"/>
      <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>

<field name="autocomplete" type="text_auto" indexed="true" stored="true"
multiValued="true" termVectors="true"/>
<copyField source="title" dest="autocomplete"/>
<copyField source="author" dest="autocomplete"/>
<copyField source="brand" dest="autocomplete"/>

<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">autocomplete</str>
  <str name="buildOnCommit">true</str>
  <float name="threshold">0.00005</float>
  <float name="threshold">0.00</float>
  <str name="buildOnCommit">false</str>
   <str
name="sourceLocation">/usr/local/solrDIH/example/solr/conf/autosuggest.txt</str-->
 </lst>
 </searchComponent>

Any suggestions on how I can achieve Case 2 behavior above ?
Also - are there any other pitfalls of using the KeyWordTokenizer ?

Thanks much!