- Assembly template system (13 templates: burrito, fried rice, omelette, stir fry, pasta, sandwich, grain bowl, soup/stew, casserole, pancakes, porridge, pie, pudding) with role-based matching, whole-word single-keyword guard, deterministic titles via MD5 pantry hash - Prep-state stripping: strips 'melted butter' → 'butter' for coverage checks; reconstructs actionable states as 'Before you start:' cooking instructions (NutritionPanel prep_notes field + RecipesView.vue display block) - FTS5 fixes: always double-quote all terms; strip apostrophes to prevent syntax errors on brands like "Stouffer's"; 'plant-based' → bare 'based' crash - Bidirectional synonym expansion: alt-meat, alt-chicken, alt-beef, alt-pork mapped to canonical texture class; pantry expansion covers 'hamburger' from 'burger patties' etc. - Texture profile backfill script (378K ingredient_profiles rows) with macro-derived classification in priority order (fatty → creamy → starchy → firm → fibrous → tender → liquid → neutral); oats/legumes starchy-first fix - LLM prompt: ban flavoured/sweetened ingredients (vanilla yoghurt) from savoury - Migrations 014 (nutrition macros) + 015 (recipe FTS index) - Nutrition estimation pipeline script - gitignore MagicMock sqlite test artifacts
16 lines
567 B
SQL
16 lines
567 B
SQL
-- Migration 015: FTS5 inverted index for recipe ingredient lookup.
|
|
--
|
|
-- Content table backed by `recipes` — stores only the inverted index, no text duplication.
|
|
-- MATCH queries replace O(N) LIKE scans with O(log N) token lookups.
|
|
--
|
|
-- One-time rebuild cost on 3.2M rows: ~15-30 seconds at startup.
|
|
-- Subsequent startups skip this migration entirely.
|
|
|
|
CREATE VIRTUAL TABLE IF NOT EXISTS recipes_fts USING fts5(
|
|
ingredient_names,
|
|
content=recipes,
|
|
content_rowid=id,
|
|
tokenize="unicode61"
|
|
);
|
|
|
|
INSERT INTO recipes_fts(recipes_fts) VALUES('rebuild');
|