sunayana
sunayana

Reputation: 43

Autocomplete in Solr with Case-insensitive feature

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 configured in schema.xml fields like this:

<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>

Upvotes: 1

Views: 381

Answers (2)

sunayana
sunayana

Reputation: 43

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.

Upvotes: 1

Ganesh
Ganesh

Reputation: 603

I tried the same schema in the Solr Admin Analysis view. You can provide the index and query value here to see how the tokens are matched.

For your schema, I tried it in my local solr instance, it seems to work fine. ie., the Game and game are considered equal and matched.

I would urge you to post the request query, and/or provide the Suggester configurations (if you are using the same).

Upvotes: 0

Related Questions