I followed the Railscast to get Sunspot running and then this tutorial on enabling wildcard searching on my search field but for some reason it still isn’t working.
Inside of my solr/conf/schema.xml I replaced the default lines with these instead for the EdgeNGramFilterFactory:
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="50" side="front"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
When I search for “ste” or “steve jobs” I get Steve Jobs, but when I try “stv jbs” or stv jobs” I get no results.
I reindexed and restarted the sunspot server a couple of times ( also the rails server).
Am I missing something here? What could be the issue?
EdgeNGramFilterFactory basically creates n-grams for the terms.
So for
steve jobswith min gram size as 1 the following tokens would be generated –As in your case searching for
stv jbsorstv jobsare more of an misspellings rather than partial matches, and would not match the documents.