Saumya Mehta
Saumya Mehta

Reputation: 368

Partial Solr search Rails 4

How to do solr search with partial string..?

For example: I am having shopping sites 'abcdef' , 'abcokp', 'abc'.. Then if I search 'abc' , then it should show all three sites. but it shows only last one 'abc'.

Any help?

Upvotes: 0

Views: 66

Answers (1)

Saumya Mehta
Saumya Mehta

Reputation: 368

Change solr/conf.schema.xml with following snippet

        <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StandardFilterFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="15"/>
        </analyzer>                                

        <analyzer type="query">
             <tokenizer class="solr.StandardTokenizerFactory"/>
             <filter class="solr.StandardFilterFactory"/>
             <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>

Restart solr and done. Any other alternative, as schema.xml does not committed?

Upvotes: 1

Related Questions