Resolved bug where null values in search terms would break search (#57)

This commit is contained in:
Kieran authored and GitHub committed 2024-03-07 12:24:20 -08:00
1 parent 1c65b41002
commit 1caddd86c7
2 files changed
+9 -2

No files matched your search

+2 -2
View File
@@ -105,9 +105,9 @@ defmodule Pinchflat.Media do
select_merge: %{
matching_search_term:
fragment("""
snippet(media_items_search_index, 0, '[PF_HIGHLIGHT]', '[/PF_HIGHLIGHT]', '...', 20) ||
coalesce(snippet(media_items_search_index, 0, '[PF_HIGHLIGHT]', '[/PF_HIGHLIGHT]', '...', 20), '') ||
' ' ||
snippet(media_items_search_index, 1, '[PF_HIGHLIGHT]', '[/PF_HIGHLIGHT]', '...', 20)
coalesce(snippet(media_items_search_index, 1, '[PF_HIGHLIGHT]', '[/PF_HIGHLIGHT]', '...', 20), '')
""")
},
order_by: [desc: fragment("rank")],