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

This commit is contained in:
Kieran
2024-03-07 12:24:20 -08:00
committed by GitHub
parent 1c65b41002
commit 1caddd86c7
2 changed files with 9 additions and 2 deletions
+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")],