GDI-HE / Mapbender2.8

Other
2 stars 0 forks source link

Fuzzy search with trigram #55

Open dpakprajul opened 5 months ago

dpakprajul commented 5 months ago

Issue copied from: https://github.com/mrmap-community/Mapbender2.8/issues/55

For the fuzzy search, there are some algorithm like levenshtein, soundex, word_similarity and so on.

https://www.postgresql.org/docs/current/fuzzystrmatch.html https://www.postgresql.org/docs/current/pgtrgm.html

In the mapbender/http/classes/class_metadata.php in line 1284, the code could be change from: $whereStr .= "searchtext LIKE $" . ($i + 1); to $whereStr .= "(strict_word_similarity($" . ($i + 1) . ", searchtext) > 0.2)";

In order to use strict_word_similarity( ) function, we need to install in the postgres first. CREATE EXTENSION pg_trgm;

Work still need to be done: Check the performance of the search, since a new algorithm is used instead of LIKE.

dpakprajul commented 1 week ago

I think its better to close this issue as it won't go further and has no future. Okay?