Since you have <tokenizer class="solr.KeywordTokenizerFactory" />, during
indexing time, it is going split the text on white spaces and then apply
edge n-grams. If you remove this & may be replace it with a simpler regex
which does basic clean up like removing multiple white spaces etc., then it
will not match on the beginning of non-first words. You can use the
analyzer and see how your text is transformed during index/query time.

On Tue, Aug 28, 2012 at 4:57 AM, aniljayanti <anil.jaya...@gmail.com> wrote:

> Hi ,
>
> Thanks for reply,
>
> Now it's working for me after changing like below.
>
> <fieldType name="edgytext" class="solr.TextField"
> positionIncrementGap="100"
> omitNorms="true">
>         <analyzer type="index">
>           <tokenizer class="solr.KeywordTokenizerFactory" />
>           <filter class="solr.LowerCaseFilterFactory" />
>           <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
>    </analyzer>
>    <analyzer type="query">
>      <tokenizer class="solr.KeywordTokenizerFactory" />
>          <filter class="solr.LowerCaseFilterFactory" />
>          <filter class="solr.EdgeNGramFilterFactory" minGramSize="1"
> maxGramSize="15" side="front" />
>    </analyzer>
>   </fieldType>
>
>
> <field name="title" type="edgytext" indexed="true" stored="true"
> omitNorms="true" omitTermFreqAndPositions="true"/>
> <field name="empname" type="edgytext" indexed="true" stored="true"
> omitNorms="true" omitTermFreqAndPositions="true" />
>
> <field name="autocomplete_text" type="edgytext" indexed="true"
> stored="false"  multiValued="true" omitNorms="true"
> omitTermFreqAndPositions="false" />
>
> <copyField source="empname" dest="autocomplete_text"/>
> <copyField source="title" dest="autocomplete_text"/>
> **************************************************************
> URL : http://localhost:8080/test/suggest/?q=michael
>
> Result :
>  <?xml version="1.0" encoding="UTF-8" ?>
> - <response>
> - <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">1</int>
>   </lst>
>   <result name="response" numFound="0" start="0" />
> - <lst name="spellcheck">
> - <lst name="suggestions">
> - <lst name="michael">
>   <int name="numFound">9</int>
>   <int name="startOffset">0</int>
>   <int name="endOffset">7</int>
> - <arr name="suggestion">
>   <str>michael bolton</str>
>   <str>michael foret</str>
>   <str>michael houser</str>
>   <str>michael o'brien</str>
>   <str>michael penn</str>
>   <str>michael row your boat ashore</str>
>   <str>michael tilson thomas</str>
>   <str>michael w. smith</str>
>   <str>michael w. smith featuring andrae crouch</str>
>   </arr>
>   </lst>
>   <str name="collation">michael bolton</str>
>   </lst>
>   </lst>
>   </response>
>
> It's working fine for me. When im searching with "michael f", getting
> response like below. (http://localhost:8080/test/suggest/?q=michael f)
>
> Response :
>
>   <?xml version="1.0" encoding="UTF-8" ?>
> - <response>
> - <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">1</int>
>   </lst>
>   <result name="response" numFound="0" start="0" />
> - <lst name="spellcheck">
> - <lst name="suggestions">
> - <lst name="michael">
>   <int name="numFound">9</int>
>   <int name="startOffset">0</int>
>   <int name="endOffset">7</int>
> - <arr name="suggestion">
>   <str>michael bolton</str>
>   <str>michael foret</str>
>   <str>michael houser</str>
>   <str>michael o'brien</str>
>   <str>michael penn</str>
>   <str>michael row your boat ashore</str>
>   <str>michael tilson thomas</str>
>   <str>michael w. smith</str>
>   <str>michael w. smith featuring andrae crouch</str>
>   </arr>
>   </lst>
> - <lst name="f">
>   <int name="numFound">10</int>
>   <int name="startOffset">8</int>
>   <int name="endOffset">9</int>
> - <arr name="suggestion">
>   <str>f**k the facts</str>
>   <str>fairest lord jesus</str>
>   <str>fatboy slim</str>
>   <str>ffh</str>
>   <str>fiona apple</str>
>   <str>foo fighters</str>
>   <str>frank sinatra</str>
>   <str>frans bauer</str>
>   <str>franz ferdinand</str>
>   <str>françois rauber</str>
>   </arr>
>   </lst>
>   <str name="collation">michael bolton f**k the facts</str>
>   </lst>
>   </lst>
>   </response>.
>
> So when i search with "michael f" then, i should get "michael foret" only.
> Data coming starts with "f". Please help me on this.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/auto-completion-search-with-solr-using-NGrams-in-SOLR-tp3998559p4003689.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to