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

Documentation explaining how to use SQLite FTS with Datasette #253

Closed
simonw opened this issue May 9, 2018 · 1 comment
Closed

Documentation explaining how to use SQLite FTS with Datasette #253

simonw opened this issue May 9, 2018 · 1 comment

Comments

@simonw
Copy link
Owner

simonw commented May 9, 2018

In particular how to work with https://www.sqlite.org/fts3.html#_external_content_fts4_tables_ - which Datasette can automatically detect and use to add a search UI to your page.

Examples of basic search setup like this:

CREATE VIRTUAL TABLE "interests_fts"
    USING FTS4 (name, content="interests");
INSERT INTO "interests_fts" (rowid, name)
    SELECT rowid, name FROM interests;

And complex join-based search setup like this:

CREATE VIRTUAL TABLE "interests_fts"
    USING FTS4 (name, category, member, content="interests");
INSERT INTO "interests_fts" (rowid, name, category, member)
    SELECT interests.rowid, interests.name, interest_categories.name, members.name
    FROM interests
        JOIN interest_categories ON interests.category_id = interest_categories.id
        JOIN members ON interests.member_id = members.id;

Also mention how csvs-to-sqlite can be used to do this easily.

This will benefit from #252

@simonw
Copy link
Owner Author

simonw commented May 12, 2018

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

1 participant