Skip to content

Add FTS5 support to sqlite #1797

Closed

Description

@kkyr

What do you want to change?

Add FTS5 support to sqlite engine.

schema.sql

CREATE TABLE recipes (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
);

CREATE VIRTUAL TABLE recipes_fts USING FTS5 (
    name,
    content='recipes',
    content_rowid='id'
);

-- (triggers omitted)

query.sql

-- name: SearchRecipes :many
SELECT rowid, * FROM recipes_fts
WHERE recipes_fts MATCH ?;

Running sqlc generate on the above input results in the following error:

db/sqlite/query.sql:17:1: relation "recipes_fts" does not exist

What database engines need to be changed?

sqlite

What programming language backends need to be changed?

Go

Activity

  1. added
    enhancementNew feature or request
    triageNew issues that hasn't been reviewed
    on Aug 14, 2022
  2. changed the title [-]Add sqlite support for FTS5[/-] [+]Add FTS5 support to sqlite[/+] on Aug 14, 2022
  3. lvignoli commented on May 19, 2023

    @lvignoli

    Hello!
    Any plan to implement this feature? :)

  4. added 2 commits that reference this issue on Jul 26, 2023
    1a48e87
    23e86ac
  5. added a commit that references this issue on Jul 26, 2023
    b04394e
  6. lvignoli commented on Jul 26, 2023

    @lvignoli

    🎉🎉🎉
    Thanks !

  7. yanc0 commented on Dec 5, 2023

    @yanc0

    @mcdoker18 @lvignoli I can't figure out how to use this.

    SELECT *
    FROM documents
    WHERE id IN (
        SELECT document_id as id FROM documents_fts
        WHERE documents_fts MATCH ?
        ORDER BY rank
    )
    LIMIT ?
    OFFSET ?;
    
    queries.sql:6:11: column "documents_fts" does not exist
    

    I want MATCH on every columns of the virtual fts5 table. I can't find a way to do this.

  8. mcdoker18 commented on Jan 3, 2024

    @mcdoker18
    Contributor

    @yanc0 Hi, sorry for the late response. This was not implemented in my commit.

  9. added a commit that references this issue on Oct 13, 2025
    cb0bd75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions