ruby on rails - Matching substrings in fulltext search not working -


in rails application, i'm using solr search. substring matching working fine on local server matching full words on deployment server.

searchable block

searchable   text :firstname, :lastname, :login, :mail   boolean :member   integer :status end 

schema.xml is.

<fieldtype name="text" class="solr.textfield" omitnorms="false">   <analyzer>     <tokenizer class="solr.standardtokenizerfactory"/>     <filter class="solr.standardfilterfactory"/>     <filter class="solr.lowercasefilterfactory"/>     <filter class="solr.porterstemfilterfactory"/>     <filter class="solr.edgengramfilterfactory" mingramsize="2" maxgramsize="10" side="front" />   </analyzer> </fieldtype> 

what doing wrong?

(adding answer here inform of possible undesired behavior)

fyi, when make changes "text" fieldtype in schema.xml changing configuration every indexed text field in application. not desired fields need custom configuration.

for example, let's (for whatever reason) wanted treat first names differently other text fields. let's wanted add synonyms of first names. first create new fieldtype in schema.xml called first_name

<fieldtype name="first_name" class="solr.textfield" positionincrementgap="100">   <analyzer>     <tokenizer class="solr.standardtokenizerfactory"/>     <filter class="solr.lowercasefilterfactory"/>     <filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/>   </analyzer> </fieldtype> 

then in fields section of schema.xml file, add 2 new dynamic fields

<dynamicfield name="*_first_name"  stored="false" type="first_name" multivalued="false" indexed="true"/> <dynamicfield name="*_first_names" stored="true"  type="first_name" multivalued="false" indexed="true"/> 

note: 's' on dynamicfield name denote it's stored type, providing * dynamic field helps sunspot configuration

so in searchable block, can do:

searchable   text :firstname, :as => :user_first_name   text :lastname, :login, :mail   boolean :member   integer :status end 

this use custom-configured "first_name" field.

if wanted first_name stored value (and still wanted use custom configuration) implement searchable block like:

searchable   text :firstname, :stored => true, :as => :user_first_names   text :lastname, :login, :mail   boolean :member   integer :status end 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -