fix(browse): use subquery for FTS5 MATCH (alias unsupported in WHERE clause)

This commit is contained in:
pyr0ball 2026-04-09 12:53:06 -07:00
parent 0d7223a12b
commit 192ecc7078

View file

@ -963,12 +963,14 @@ class Store:
rows = self._fetch_all( rows = self._fetch_all(
""" """
SELECT r.id, r.title, r.category, r.keywords, r.ingredient_names, SELECT id, title, category, keywords, ingredient_names,
r.calories, r.fat_g, r.protein_g, r.sodium_mg calories, fat_g, protein_g, sodium_mg
FROM recipe_browser_fts fts FROM recipes
JOIN recipes r ON r.id = fts.rowid WHERE id IN (
WHERE fts MATCH ? SELECT rowid FROM recipe_browser_fts
ORDER BY r.id ASC WHERE recipe_browser_fts MATCH ?
)
ORDER BY id ASC
LIMIT ? OFFSET ? LIMIT ? OFFSET ?
""", """,
(match_expr, page_size, offset), (match_expr, page_size, offset),