Time for action – searching for similar terms with fuzzy search

Even if the wildcard queries are very flexible, sometimes they simply cannot give us a good result. There could be some weird typo in the term, but we still want to obtain good results wherever it is possible under certain confidence conditions:

  1. If we want to write painting and I actually search for plainthing, use the following command:
    >> curl – X GET 'http://localhost:8983/solr/paintings/select?q=abstract:plainthing~0.5&wt=json'
    
  2. And if we have a person using a different language who searched for leonardo by misspelling the name we use the following command:
    >> curl -X GET 'http://localhost:8983/solr/paintings/select?q=abstract:lionardo~0.5&wt=json'
    

In both cases, the examples use misspelled words to be recognizable, but the same syntax can be used for intercept existing similar words.

What just happened?

Both the preceding examples work as expected. The first gives us documents containing the term painting and the second gives us documents containing leonardo. Notice that the syntax plainthing^0.5 represents a query that matches with a certain confidence. So, we will also obtain occurrences of documents with the term paintings, which is good. But, we could receive weird results in a more general case. In order to set up the confidence value properly, there are not many options apart from doing tests.

Tip

Using fuzzy search is a simple way of obtaining a suggested result for alternate forms of search query, just like when we trust some search engine's similar suggestions in the did you mean approach.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.216.7