Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Trigram pg extension for more performant text similarity searches #1466

Open
maindsh opened this issue Dec 8, 2023 · 1 comment
Open

Comments

@maindsh
Copy link

maindsh commented Dec 8, 2023

It is a known fact that using LIKE and ILIKE queries all of rows are scanned in the table. Compared to using Trigram (pg extension) instead of sequentially scanning all of the rows in the document, only the gin index is scanned which is at least 100X faster.

https://mazeez.dev/posts/pg-trgm-similarity-search-and-fast-like

Related to this is Ransack *_matches (and others) which internally uses these LIKE queries https://activerecord-hackery.github.io/ransack/getting-started/search-matches/

So my question is, is there a way to override the Ransack matchers to use Similarity function similarity('your-search-term') instead of LIKE ?

@iamonkara
Copy link

+100

We are in much need of a performant full text search and I would be happy to implement it if some maintainer can share some clues on which classes to look into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants