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

table.enable_fts(..., replace=True) #160

Closed
simonw opened this issue Sep 20, 2020 · 1 comment
Closed

table.enable_fts(..., replace=True) #160

simonw opened this issue Sep 20, 2020 · 1 comment
Labels
enhancement New feature or request python-library
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Sep 20, 2020

I noticed that https://til.simonwillison.net/ search doesn't use porter stemming. I'd like to add that, but since the build script always operates on an existing database (to avoid re-rendering markdown and re-building image thumbnails) I'd like it to only add porter stemming if it's not there already.

So I'd like to be able to say "set up FTS to look like this, and fix it if it doesn't".

I think the neatest way to do that is with a replace=True argument to .enable_fts(), for consistency with def .create_view(self, name, sql, replace=True).

So the replace=True argument would check and see if the configured FTS exists already with the correct options (columns, stemming, triggers) - and if any of those are incorrect it would call .disable_fts() and then create a new FTS configuration with the correct options.

@simonw simonw added the enhancement New feature or request label Sep 20, 2020
@simonw
Copy link
Owner Author

simonw commented Sep 20, 2020

Should this support ignore=True as well? I'm tempted to skip that - I think replace=True is more useful because it implies "ignore if the options are already the same, but replace if they are different".

@simonw simonw added this to the 2.19 milestone Sep 20, 2020
@simonw simonw changed the title Idea: .enable_fts(..., replace=True) table.enable_fts(..., replace=True) Sep 20, 2020
@simonw simonw closed this as completed in ecb50c8 Sep 20, 2020
simonw added a commit that referenced this issue Sep 20, 2020
simonw added a commit to simonw/til that referenced this issue Sep 20, 2020
First time using replace=True, refs simonw/sqlite-utils#160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python-library
Projects
None yet
Development

No branches or pull requests

1 participant