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

Sqlite MATCH text search #279

Closed
jonluca opened this issue Jan 13, 2023 · 1 comment · Fixed by #280
Closed

Sqlite MATCH text search #279

jonluca opened this issue Jan 13, 2023 · 1 comment · Fixed by #280
Labels
api Related to library's API enhancement New feature or request sqlite Related to sqlite typescript Related to Typescript

Comments

@jonluca
Copy link
Contributor

jonluca commented Jan 13, 2023

If I have a sqlite db with a virtual table using fts like so:

CREATE VIRTUAL TABLE posts 
USING FTS4(title, body);

and then I try and reference it within Kysely

const statement = db
      .selectFrom("posts")
      .selectAll()
      .where("posts", "match", search)
      .limit(100);

I get a type error on match.

The syntax for the query would look like

SELECT * 
FROM posts 
WHERE posts MATCH 'text' ;

Are match queries supported in kysely?

Thanks in advance

@koskimas
Copy link
Member

You can pass any operator using raw sql

where('posts', sql`match`, search)

@igalklebanov igalklebanov added api Related to library's API sqlite Related to sqlite typescript Related to Typescript enhancement New feature or request labels Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API enhancement New feature or request sqlite Related to sqlite typescript Related to Typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants