Let's suppose that you run an e-commerce site with an electronic assortment. The marketing department can be a source of many great ideas. Imagine that your colleague from this department comes to you and says that they would like your search application to be able to find documents containing the word "PowerShot" by entering the words "power" and "shot" into the search box. So can we do that? Of course, and this recipe will show you how.
Let's start by creating the following index structure (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_split" indexed="true" stored="true" />
To split text in the
description
field, we should add the following type definition to theschema.xml
file:<fieldType name="text_split" class="solr.TextField"> <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory...