I need to implement fuzzy search on database layer, but I am having some minor issues. Here is my SQL code for demonstration :
SELECT *
FROM (SELECT *
FROM TOOLS
WHERE UTL_MATCH.jaro_winkler_similarity(UPPER('sample tool'), UPPER(NAME)) > 80
ORDER BY UTL_MATCH.EDIT_DISTANCE_SIMILARITY('sample tool', NAME) DESC)
where ROWNUM <= 10;
I am selecting 10 tools that match best the criteria of jaro winkler and edit distance similarity utl functions. Struggle I am having is, that I am not getting exact matches first. For example when I type rich the best scored candidate is 'mich' and then are tools with name 'rich' for example 'rich 12', 'rich ax', ...
- Is it possible to get "exact matches" first with these utl functions or is there any function that fits my requirements better? Our fuzzy search should be focused more on skipping some characters rather than replacing them for another.
- Is it possible to not take into account word length with these functions? (for example when I type 'di' I want to get results as 'dinosaur', but the word doesn't match my score criteria only because its length and I am getting no results.