simonw / datasette.io

The official project website for Datasette
https://datasette.io
92 stars 21 forks source link

Search is broken #152

Closed simonw closed 1 year ago

simonw commented 1 year ago

https://datasette.io/-/beta?q=css

CleanShot 2023-09-08 at 15 19 11@2x
simonw commented 1 year ago

Downgrading to 0.64 did not fix it:

The index at https://datasette.io/dogsheep-index has stuff in though.

simonw commented 1 year ago

Huh... these both returned 0 results:

Even though https://datasette.io/dogsheep-index/search_index lists 2,646 rows and a like search https://datasette.io/dogsheep-index/search_index?title__contains=css returns results.

simonw commented 1 year ago
select count(rowid) from search_index where rowid in (select rowid from search_index_fts)

Returns 2646 so it's not a mismatch in rowid values.

simonw commented 1 year ago

I downloaded the DB and replicated the bug locally, then ran this:

sqlite-utils rebuild-fts dogsheep-index.db

And it seemed to fix it!

simonw commented 1 year ago

Here's what that does: https://github.com/simonw/sqlite-utils/blob/5d123f031fc4fadc98f508e0ef6b7b6671e86155/sqlite_utils/cli.py#L331-L337C34

Which runs INTO [{table}]([{table}]) VALUES('rebuild');.

simonw commented 1 year ago

If this fixes it I should update dogsheep-beta index to run a rebuild after it does the indexing.

simonw commented 1 year ago

That fixed it.