dogsheep / dogsheep-beta

Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
https://dogsheep.github.io/
186 stars 6 forks source link

Deleted records stay in the search index #18

Open simonw opened 4 years ago

simonw commented 4 years ago

Here's why: https://github.com/dogsheep/dogsheep-beta/blob/24f7898d41a39218058f174c75ba62f7c0fcfff6/dogsheep_beta/utils.py#L44-L53

That should probably do DELETE FROM index1.search_index WHERE [table] = ? first.

simonw commented 4 years ago

Alternatively it could run as it does now but add a DELETE FROM index1.search_index WHERE key not in (select key from ...).

I'm not sure which would be more efficient.

simonw commented 4 years ago

I'm inclined to go with the first, simpler option. I have longer term plans for efficient incremental index updates based on clever trickery with triggers.