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 Sunayana <su...@wipro.com> on 2014/04/15 09:50:33 UTC
Autocomplete with Case-insensitive feature
Hi All,
I have been trying out this autocomplete feature in Solr4.7.1 using
Suggester.I have configured it to display phrase suggestions also.Problem is
If I type "game" I get suggestions as "game" or phrases containing "game".
But If I type "Game" *no suggestion is displayed at all*.How can I get
suggestions case-insensitive?
I have defined in schema.xml fields like this:
<field name="name_autocomplete" type="text_auto" indexed="true"
stored="true" multiValued="true" />
<copyField source="name" dest="name_autocomplete" />
<fieldType name="text_auto" class="solr.TextField"
positionIncrementGap="100" >
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ShingleFilterFactory"
minShingleSize="2"
maxShingleSize="4"
outputUnigrams="true"
outputUnigramsIfNoShingles="true"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.TrimFilterFactory" />
</analyzer>
</fieldType>
--
View this message in context: http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Autocomplete with Case-insensitive feature
Posted by Sunayana <su...@wipro.com>.
What worked for me was tweaking a code from velocity file, head.vm, I changed
'terms.prefix': function() { return $("#q").val().toLowerCase();}, which
solved my issue as I am using terms component for suggestions.
Dmitry Kan-2 wrote
> what kind of suggester are you using? Does its index get rebuilt when you
> reindex your data?
> From the analysis page at least I see, that you get a hit on Game, which
> is
> lowercased to game.
>
>
> On Thu, Apr 17, 2014 at 10:55 AM, Sunayana <
> sunayana.02@
> > wrote:
>
>> 1.My field definition:
>>
> <fieldType name="text_auto" class="solr.TextField"
>>
> positionIncrementGap="100" >
>>
> <analyzer type="index">
>>
> <tokenizer class="solr.StandardTokenizerFactory"/>
>>
> <filter class="solr.LowerCaseFilterFactory"/>
>>
> <filter class="solr.ShingleFilterFactory"
>>
> minShingleSize="2"
>> maxShingleSize="4"
>> outputUnigrams="true"
>> outputUnigramsIfNoShingles="true"/>
>>
> </analyzer>
>>
> <analyzer type="query">
>>
> <tokenizer class="solr.StandardTokenizerFactory"/>
>>
> <filter class="solr.LowerCaseFilterFactory"/>
>>
> </analyzer>
>>
> </fieldType>
>>
>> 2.On analysis page, it shows me the lowercased word,for both index as
>> well
>> as query analyzers.Attaching a screenshot. Is there any other step that I
>> am
>> mising out?
>> <http://lucene.472066.n3.nabble.com/file/n4131663/analysis.png>
>>
>> Dmitry Kan-2 wrote
>> > Could you show the updated field definition?
>> > Does analysis page show sensible output for your query on
>> > indexing/querying
>> > sides?
>> >
>> >
>> > On Wed, Apr 16, 2014 at 5:52 PM, Sunayana <
>>
>> > sunayana.02@
>>
>> > > wrote:
>> >
>> >> Thanks for replying,
>> >> 1.Yes,I re-indexed data after the changes.
>> >> 2.Changing to STF, did not help..
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131499.html
>> >> Sent from the Solr - User mailing list archive at Nabble.com.
>> >>
>> >
>> >
>> >
>> > --
>> > Dmitry
>> > Blog: http://dmitrykan.blogspot.com
>> > Twitter: http://twitter.com/dmitrykan
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131663.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>
>
> --
> Dmitry
> Blog: http://dmitrykan.blogspot.com
> Twitter: http://twitter.com/dmitrykan
--
View this message in context: http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4135560.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Autocomplete with Case-insensitive feature
Posted by Dmitry Kan <so...@gmail.com>.
what kind of suggester are you using? Does its index get rebuilt when you
reindex your data?
>From the analysis page at least I see, that you get a hit on Game, which is
lowercased to game.
On Thu, Apr 17, 2014 at 10:55 AM, Sunayana <su...@wipro.com> wrote:
> 1.My field definition:
> <fieldType name="text_auto" class="solr.TextField"
> positionIncrementGap="100" >
> <analyzer type="index">
> <tokenizer class="solr.StandardTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.ShingleFilterFactory"
> minShingleSize="2"
> maxShingleSize="4"
> outputUnigrams="true"
> outputUnigramsIfNoShingles="true"/>
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.StandardTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> </analyzer>
> </fieldType>
>
> 2.On analysis page, it shows me the lowercased word,for both index as well
> as query analyzers.Attaching a screenshot. Is there any other step that I
> am
> mising out?
> <http://lucene.472066.n3.nabble.com/file/n4131663/analysis.png>
>
> Dmitry Kan-2 wrote
> > Could you show the updated field definition?
> > Does analysis page show sensible output for your query on
> > indexing/querying
> > sides?
> >
> >
> > On Wed, Apr 16, 2014 at 5:52 PM, Sunayana <
>
> > sunayana.02@
>
> > > wrote:
> >
> >> Thanks for replying,
> >> 1.Yes,I re-indexed data after the changes.
> >> 2.Changing to STF, did not help..
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131499.html
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> >>
> >
> >
> >
> > --
> > Dmitry
> > Blog: http://dmitrykan.blogspot.com
> > Twitter: http://twitter.com/dmitrykan
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131663.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Dmitry
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan
Re: Autocomplete with Case-insensitive feature
Posted by Sunayana <su...@wipro.com>.
1.My field definition:
<fieldType name="text_auto" class="solr.TextField"
positionIncrementGap="100" >
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ShingleFilterFactory"
minShingleSize="2"
maxShingleSize="4"
outputUnigrams="true"
outputUnigramsIfNoShingles="true"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
2.On analysis page, it shows me the lowercased word,for both index as well
as query analyzers.Attaching a screenshot. Is there any other step that I am
mising out?
<http://lucene.472066.n3.nabble.com/file/n4131663/analysis.png>
Dmitry Kan-2 wrote
> Could you show the updated field definition?
> Does analysis page show sensible output for your query on
> indexing/querying
> sides?
>
>
> On Wed, Apr 16, 2014 at 5:52 PM, Sunayana <
> sunayana.02@
> > wrote:
>
>> Thanks for replying,
>> 1.Yes,I re-indexed data after the changes.
>> 2.Changing to STF, did not help..
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131499.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>
>
> --
> Dmitry
> Blog: http://dmitrykan.blogspot.com
> Twitter: http://twitter.com/dmitrykan
--
View this message in context: http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131663.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Autocomplete with Case-insensitive feature
Posted by Dmitry Kan <so...@gmail.com>.
Could you show the updated field definition?
Does analysis page show sensible output for your query on indexing/querying
sides?
On Wed, Apr 16, 2014 at 5:52 PM, Sunayana <su...@wipro.com> wrote:
> Thanks for replying,
> 1.Yes,I re-indexed data after the changes.
> 2.Changing to STF, did not help..
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131499.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Dmitry
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan
Re: Autocomplete with Case-insensitive feature
Posted by Sunayana <su...@wipro.com>.
Thanks for replying,
1.Yes,I re-indexed data after the changes.
2.Changing to STF, did not help..
--
View this message in context: http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131499.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Autocomplete with Case-insensitive feature
Posted by Dmitry Kan <so...@gmail.com>.
1. did you re-index after changing schema?
2. Why do use KeywordTokenizerFactory and not StandardTokenizerFactory? KTF
treats entire field contents as one token. Does it do what you really want?
[1]
3. If you'd use STF, TrimFilterFactory would be obsolete, as tokenization
has been done already.
[1]
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.KeywordTokenizerFactory
On Tue, Apr 15, 2014 at 12:24 PM, Sunayana <su...@wipro.com> wrote:
> Hi,
>
> Did u mean changing field type as
> <fieldType name="text_auto" class="solr.TextField"
> positionIncrementGap="100" indexed="true" stored="false"
> multiValued="true">
> <analyzer type="index">
> <tokenizer class="solr.StandardTokenizerFactory"/>
> <filter
> class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.ShingleFilterFactory"
> minShingleSize="2"
> maxShingleSize="4"
> outputUnigrams="true"
> outputUnigramsIfNoShingles="true"/>
>
>
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter
> class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.TrimFilterFactory" />
>
> </analyzer>
> </fieldType>
>
> This did not work out for me.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131198.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Dmitry
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan
Re: Autocomplete with Case-insensitive feature
Posted by Sunayana <su...@wipro.com>.
Hi,
Did u mean changing field type as
<fieldType name="text_auto" class="solr.TextField"
positionIncrementGap="100" indexed="true" stored="false"
multiValued="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ShingleFilterFactory"
minShingleSize="2"
maxShingleSize="4"
outputUnigrams="true"
outputUnigramsIfNoShingles="true"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.TrimFilterFactory" />
</analyzer>
</fieldType>
This did not work out for me.
--
View this message in context: http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182p4131198.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Autocomplete with Case-insensitive feature
Posted by Dmitry Kan <so...@gmail.com>.
Hi,
Configure LowerCaseFilterFactory into the "query" side of your type config.
Dmitry
On Tue, Apr 15, 2014 at 10:50 AM, Sunayana <su...@wipro.com> wrote:
> Hi All,
>
> I have been trying out this autocomplete feature in Solr4.7.1 using
> Suggester.I have configured it to display phrase suggestions also.Problem
> is
> If I type "game" I get suggestions as "game" or phrases containing "game".
> But If I type "Game" *no suggestion is displayed at all*.How can I get
> suggestions case-insensitive?
> I have defined in schema.xml fields like this:
> <field name="name_autocomplete" type="text_auto" indexed="true"
> stored="true" multiValued="true" />
> <copyField source="name" dest="name_autocomplete" />
> <fieldType name="text_auto" class="solr.TextField"
> positionIncrementGap="100" >
> <analyzer type="index">
> <tokenizer class="solr.StandardTokenizerFactory"/>
> <filter
> class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.ShingleFilterFactory"
> minShingleSize="2"
> maxShingleSize="4"
> outputUnigrams="true"
> outputUnigramsIfNoShingles="true"/>
>
>
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.TrimFilterFactory" />
>
> </analyzer>
> </fieldType>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Autocomplete-with-Case-insensitive-feature-tp4131182.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Dmitry
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan