RailsCasts Pro episodes are now free!

Learn more or hide this

Arndt Lehmann's Profile

GitHub User: alehmann

Site: www.arndtlehmann.com

Comments by Arndt Lehmann

Avatar

You set this up on SOLR side by switching to the EdgeNGram filter

diff --git a/solr/conf/schema.xml b/solr/conf/schema.xml
index 6a83419..b4b62dd 100644
--- a/solr/conf/schema.xml
+++ b/solr/conf/schema.xml
@@ -59,13 +59,17 @@
     <!-- *** This fieldType is used by Sunspot! *** -->
     <fieldType name="rand" class="solr.RandomSortField" omitNorms="true"/>
     <!-- *** This fieldType is used by Sunspot! *** -->
-    <fieldType name="text" class="solr.TextField" omitNorms="false">
-      <analyzer>
-        <tokenizer class="solr.StandardTokenizerFactory"/>
-        <filter class="solr.StandardFilterFactory"/>
+    <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>
-    </fieldType>
+      <analyzer type="query">
+        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
+        <filter class="solr.LowerCaseFilterFactory"/>
+      </analyzer>
+    </fieldtype>