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

feat: apply to_tsvector to the filtered columns when a fts operator is used #3845

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

laurenceisla
Copy link
Member

@laurenceisla laurenceisla commented Jan 14, 2025

Closes #2255

When an fts operator is used, then it applies to_tsvector to the filtered column. For example:

/table?column=fts(simple).test

is equivalent to this in SQL:

SELECT *
FROM table
WHERE to_tsvector('simple', column) = to_tsquery('simple', 'test')
If the `totsv` modifier (short for `to_tsvector`) is used for `fts` operators then it applies `to_tsvector` to the filtered column. For example:
/table?column=totsv.fts(simple).test

Is equivalent to this in SQL:

SELECT *
FROM table
WHERE to_tsvector('simple', column) = to_tsquery('simple', 'test')

@laurenceisla laurenceisla force-pushed the feat-totsv branch 2 times, most recently from b9cee18 to b8f8db2 Compare January 14, 2025 16:14
@laurenceisla laurenceisla marked this pull request as ready for review January 14, 2025 16:16
@laurenceisla laurenceisla changed the title feat: add "totsv" modifier to the "fts" operator feat: apply to_tsvector to the filtered columns when a fts operator is used Jan 21, 2025
@laurenceisla laurenceisla force-pushed the feat-totsv branch 2 times, most recently from 9bffd08 to cb069ea Compare January 25, 2025 21:31
Copy link
Member

@steve-chavez steve-chavez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 💯

@laurenceisla laurenceisla merged commit b7d0a1f into PostgREST:main Jan 29, 2025
23 of 24 checks passed
@laurenceisla laurenceisla deleted the feat-totsv branch January 29, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Change FTS operators to explicitly call to_tsvector()
3 participants