Instead of <tokenizer class="solr.WhitespaceTokenizerFactory" /> use
<tokenizer class="solr.KeywordTokenizerFactory"/>

Cheers
Avlesh

2009/9/16 Vincent Pérès <vincent.pe...@gmail.com>

>
> Hello,
>
> I'm using the following code for my autocomplete feature :
>
> The field type :
>
>    <fieldType name="autoComplete" class="solr.TextField" omitNorms="true">
>      <analyzer>
>        <tokenizer class="solr.WhitespaceTokenizerFactory" />
>        <filter class="solr.LowerCaseFilterFactory" />
>        <filter class="solr.EdgeNGramFilterFactory" maxGramSize="20"
> minGramSize="2" />
>      </analyzer>
>      <analyzer type="query">
>        <tokenizer class="solr.WhitespaceTokenizerFactory" />
>        <filter class="solr.LowerCaseFilterFactory" />
>        <filter class="solr.PatternReplaceFilterFactory"
> pattern="^(.{20})(.*)?" replacement="$1" replace="all" />
>      </analyzer>
>    </fieldType>
>
> The field :
>
> <dynamicField name="*_ac" type="autoComplete" indexed="true" stored="true"
> />
>
> The query :
>
> ?q=*:*&fq=query_ac:harry*&wt=json&rows=15&start=0&fl=*&indent=on&fq=model:SearchQuery
>
> It gives me a list of results I can parse and use with jQuery autocomplete
> plugin and all that works very well.
>
> Example of results :
> > harry
> > harry potter
> > the last fighting harry
> > harry potter 5
> > comic relief harry potter
>
> What I would like to do now is only to have results starting with the
> query,
> so it should be :
> > harry
> > harry potter
> > harry potter 5
>
> Can anybody tell me if it is possible and so how to do it ?
>
> Thank you !
> Vincent
> And
> --
> View this message in context:
> http://www.nabble.com/Need-help-to-finalize-my-autocomplete-tp25468885p25468885.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Reply via email to