add FTS5 full-text product search

Adds SQLite FTS5 search index with BM25 ranking across product title,
category, variant attributes, and description. Search modal now has
live results with thumbnails, prices, and click-to-navigate. Index
rebuilds automatically after each provider sync.

Also fixes Access syntax on Product/ProductImage structs (Map.get
instead of bracket notation) which was causing crashes when real
products were loaded from the database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-13 07:29:19 +00:00
parent 35e0386abb
commit 037cd168cd
19 changed files with 603 additions and 34 deletions

View File

@@ -337,8 +337,8 @@ defmodule SimpleshopThemeWeb.Admin.Theme.Index do
defp preview_page(%{page: :pdp} = assigns) do
product = List.first(assigns.preview_data.products)
option_types = product[:option_types] || []
variants = product[:variants] || []
option_types = Map.get(product, :option_types) || []
variants = Map.get(product, :variants) || []
{selected_options, selected_variant} =
case variants do
@@ -468,7 +468,7 @@ defmodule SimpleshopThemeWeb.Admin.Theme.Index do
defp build_gallery_images(product) do
alias SimpleshopTheme.Products.ProductImage
(product[:images] || [])
(Map.get(product, :images) || [])
|> Enum.sort_by(& &1.position)
|> Enum.map(fn img -> ProductImage.direct_url(img, 1200) end)
|> Enum.reject(&is_nil/1)