Suggester
In the preceding section, we have seen how Solr handles incorrectly spelled terms and then returns the correct output for them. Let's move one step ahead and provide a feature wherein the user always enters correct spellings but we want to be a step ahead and provide list of suggestions using whatever the user has already typed. This can be achieved by a Solr tool called suggester. The suggester suggests terms when the user types words. During the implementation of the suggester, we need to consider these two things:
- It must be very fast as we need to display suggestions on the user's characters type
- The suggestions should be ranked and ordered by term frequency
To configure any suggester, SuggestComponent
needs to be configured in solrconfig.xml
. Here is a simple configuration of a suggester:
<searchComponent name="suggest" class="solr.SuggestComponent"> <lst name="suggester"> <str name="name">mySuggester</str> <str name="lookupImpl">FuzzyLookupFactory...