Casecommons / pg_search

pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search
http://www.casebook.net
MIT License
1.3k stars 369 forks source link

Add support for trigram strict_word_similarity function #539

Open nunesmatheus opened 1 month ago

nunesmatheus commented 1 month ago

Allows using the postgres function strict_word_similarity for trigram matching, that, according to postgres, is

useful for finding the similarity to whole words, while word_similarity is more suitable for finding the similarity for parts of words

It's my first contribution, so I'm sorry if I miss something.

If this is something you would like to add to the project, I wonder if we should validate that word_similarity and strict_word_similarity options cannot both be given, as only one will be applied. Or even if it's worth it to make a breaking change and replace the word_similarity option by a similarity_function option, or something like that.