Controlling the number of terms needed to match
Imagine a situation where you have an e-commerce bookstore and you want to make a search algorithm that tries to bring the best search results to your customers. However, you notice that many of your customers tend to make queries with too many words, which results in an empty result list. So, you decide to make a query that will require a maximum of two of the words, which the user entered, to be matched. This recipe will show you how to do it.
Getting ready
Before we continue, it is crucial to mention that the following method can only be used with the dismax
or edismax
query parser. For the list of available query parsers, refer to http://wiki.apache.org/solr/QueryParser.
How to do it...
Follow these ...
Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.