Imagine a situation where you have an e-commerce library and you want to make a search algorithm that tries to bring the best search results to your customers. But you noticed that many of your customers tend to make queries with too many words, which result in an empty results list. So you decided to make a query that will require the maximum of two of the words that the user entered to be matched. This recipe will show you how to do it.
This method can only be used with the DisMax query parser. The standard query parser doesn't support the mm
parameter.
Let's begin with creating our index that has the following 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="title" type="text" indexed="true" stored="true" />
As you can see our books are described by two fields.
Now let's look at the example...