Select most similar values in Sphinx index and order them by similarity

688 views Asked by At

I need Sphinx to give me partial/incomplete matches, like if a word has been misspelled in the search. My goal is to find the most similar string in my index.

My index has id, and name, which consists of a string (between 1 and 4 words).

For example, "milk" is in my index, but if I search "skim milk" or "mikl", there is no results.

The query I have right now:

SELECT * FROM test1 WHERE MATCH('milk') OPTION ranker = proximity

I've been through the doc, but I must admit I feel quite lost. I greatly appreciated any help you can give.

EDIT: I've set expand_keywords to 1 and tried min_infix_len and min_infix_len without success.

2

There are 2 answers

0
barryhunter On

Well sphinx is setup for matching and ranking whole documents. Usually where documents contain many words.

Sounds like want a way to 'match' words, so can forexample correct mikl to milk.

The new CALL SUGGEST feature sounds like what want http://sphinxsearch.com/blog/2016/10/03/2-3-2-feature-built-in-suggests/

Run queries though this first.

0
Manticore Search On

Here's an interactive course on how it works in Sphinx/Manticore - https://play.manticoresearch.com/didyoumean/