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 Brian Lamb <br...@journalexperts.com> on 2011/09/01 17:27:44 UTC
Autocomplete
Hi all,
I've read numerous guides on how to set up autocomplete on solr and it works
great the way I have it now. However, my only complaint is that it only
matches the beginning of the word. For example, if I try to autocomplete
"dober", I would only get, "Doberman", "Doberman Pincher" but not "Pincher,
Doberman". Here is how my schema is configured:
<fieldType name="edgytext" class="solr.TextField"
positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1"
maxGramSize="25" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<field name="autocomplete_text" type="edgytext" indexed="true" stored="true"
omitNorms="true" omitTermFreqAndPositions="true" />
How can I update my autocomplete so that it will match the middle of a word
as well as the beginning of the word?
Thanks,
Brian Lamb
Re: Autocomplete
Posted by Brian Lamb <br...@journalexperts.com>.
I found that if I change
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25"
/>
to
<filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="25" />
I can do autocomplete in the middle of a term.
Thanks!
Brian Lamb
On Thu, Sep 1, 2011 at 11:27 AM, Brian Lamb
<br...@journalexperts.com>wrote:
> Hi all,
>
> I've read numerous guides on how to set up autocomplete on solr and it
> works great the way I have it now. However, my only complaint is that it
> only matches the beginning of the word. For example, if I try to
> autocomplete "dober", I would only get, "Doberman", "Doberman Pincher" but
> not "Pincher, Doberman". Here is how my schema is configured:
>
> <fieldType name="edgytext" class="solr.TextField"
> positionIncrementGap="100">
> <analyzer type="index">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.EdgeNGramFilterFactory" minGramSize="1"
> maxGramSize="25" />
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> </analyzer>
> </fieldType>
>
> <field name="autocomplete_text" type="edgytext" indexed="true"
> stored="true" omitNorms="true" omitTermFreqAndPositions="true" />
>
> How can I update my autocomplete so that it will match the middle of a word
> as well as the beginning of the word?
>
> Thanks,
>
> Brian Lamb
>