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

Support of pg_trgm with ranking #132

Open
blasterpistol opened this issue Jul 22, 2020 · 4 comments
Open

Support of pg_trgm with ranking #132

blasterpistol opened this issue Jul 22, 2020 · 4 comments

Comments

@blasterpistol
Copy link

Currently I have the query

create index on pub.product using gin (title gin_trgm_ops);

select title 
  from pub.product 
 where title %> 'search phrase' 
 order by title <->> 'search phrase';

I will be grateful for adding this functionality to the library, or instructions on how to write this plugin yourself.

@mattbretl
Copy link
Member

mattbretl commented Aug 2, 2021

I'm not familiar with pg_trgm, but it should definitely be doable. As a starting point, consider looking at https://github.com/graphile-contrib/postgraphile-plugin-connection-filter-postgis which extends this plugin with PostGIS-specific operators.

@mattbretl
Copy link
Member

Caveat: if you need ORDER BY, there'll be more work involved. This plugin is only concerned with augmenting the WHERE clause.

@TimoStolz
Copy link

I'm interested, too. Do you have some code example for fetching all text/varchar columns, that are covered by an index using gist or gin?

@TimoStolz
Copy link

Probably the fulltext plugin could be a related use case: https://github.com/mlipscombe/postgraphile-plugin-fulltext-filter

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

No branches or pull requests

3 participants