Normalized search index

So that one can search for 'bjorn' and find 'Bjørn'
This commit is contained in:
Claudio Ortolina
2025-05-25 09:26:01 +01:00
parent c2943174a2
commit ad29b8f96d
2 changed files with 281 additions and 0 deletions
+6
View File
@@ -76,10 +76,16 @@ defmodule MusicLibrary.Records do
{:artist, artist}, search ->
search
|> where(fragment("records_search_index match 'artists : ?*'", literal(^artist)))
|> or_where(
fragment("records_search_index match 'normalized_artists : ?*'", literal(^artist))
)
{:album, album}, search ->
search
|> where(fragment("records_search_index match 'title : ?*'", literal(^album)))
|> or_where(
fragment("records_search_index match 'normalized_title : ?*'", literal(^album))
)
{:genre, genre}, search ->
search