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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user