table.enable_fts(..., replace=True)
Closed this issue · 1 comments
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.
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".