I'd like to set up my indexing so that phonetic-matched results are given less weight than regular matches.
To do this, I've created two different fieldType sets in my schema.xml for text:
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ISOLatin1AccentFilterFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
</analyzer>
</fieldType>
<fieldType name="text_phonetic" class="solr.TextField" omitNorms="false">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ISOLatin1AccentFilterFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
<filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
</analyzer>
</fieldType>
and created a dynamcicField that uses the phonetic factory:
<dynamicField name="*_phonetic" stored="false" type="text_phonetic" multiValued="true" indexed="true"/>
Now in my model I can do something like:
text :name, :as => :name_phonetic
and it works fine.
My question is, what is the best way to go about setting up a bunch of fields to use both the regular text field indexing alongside the phonetic one, with a higher boost to the first? I can just duplicate all of my indexing lines in my model, but is there a way for me to do this directly in the schema with the construct and have that available in the sunspot fulltext query?