Nowadays it's nice to have stemming algorithms
(algorithms that will reduce words to their stems or root form) in your application, which will allow you to find the words such as cat
and cats
by typing cat
. But let's imagine you have a search engine that searches through the contents of books in the library. One of the requirements is changing the plural forms of the words from plural to singular – nothing less, nothing more. Can Solr do that? Yes, the newest version can and this recipe will show you how to do that.
First of all let's start with a simple two field index (add this to your
schema.xml
file to the field definition section):<field name="id" type="string" indexed="true" stored="true" required="true"/> <field name="description" type="text_light_stem" indexed="true" stored="true" />
Now let's define the
text_light_stem
type which should look like this (add this to yourschema.xml
file):<fieldType name="text_light_stem...