Closed simonw closed 2 years ago
The problem is this query, used for calculating the display snippet in the results: https://github.com/simonw/datasette.io/blob/9dffe361b0210b9d8b1f2fb820a3f2193f0f2fc7/templates/dogsheep-beta.yml#L68-L85
It throws an error if :q
is an empty string.
So I needed to figure out a FTS query that will always return true. This was surprisingly hard! In the end this looks to work - since I know that the title of the row will always be included in the FTS index for that row:
where
id = :key
and sections_fts match escape_fts(case when :q = '' then sections.title else :q end)
https://datasette.io/-/beta?sort=oldest says: