1

I would like to understand why the distance between 2 words is so big with just a letter reverse.

Example:

SELECT name, searchable, searchable <-> 'fluerie' AS dist FROM shd_appellations WHERE region_id=3 ORDER BY dist LIMIT 1;

Result:

fleurie => 0,6666666

So, the distance is 0,666 between fluerie and fleurie ! I know the word is truncated into "flu", "lue", ... "rie" before comparing but I need to set a limit in my code and I fix it to 0.5 maximum distance to obtain a result... so in this case the matching is not taken.

I could set a max distance of 0.75... but I don't want to match other terms not related to search in some other cases.

An idea: could it be logical to increase the distance for small words, so depending search term width ?

alex.bour
  • 2,842
  • 9
  • 40
  • 66

0 Answers0