You can do this on the SOLR configuration site. To setup stemming in SOLR you just need to set the tokenizer and analyzer for the field.
For example. Say you have a field in your template called Body Text
- rather than use the dynamic SOLR field, you can add this to your schema.xml
.
<field name="body_text" type="text_stem" indexed="true" stored="true" multiValued="true"/>
Now we just need to define the field type in the schema and set the tokenizer and filter:
<fieldType name="text_stem">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SnowballPorterFilterFactory"/>
</analyzer>
</fieldType>
What do these do:
- solr.WhitespaceTokenizerFactory - this will break up the sentences into words using whitespace as the delimeter
- solr.SnowballPorterFilterFactory - will apply a stemming algorithm to each work or token. There are a number of stemming algorithms, this example uses the
Snowball Porter
one.
For more examples look at Keyword Stemming and Lemmatisation with SOLR