Introduce separate search index

Uses a fts5 virtual table, kept up to date via triggers on the records
table.
This commit is contained in:
Claudio Ortolina
2024-11-22 10:01:48 +00:00
parent be36c29f76
commit 2e2000fe01
6 changed files with 215 additions and 27 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ defmodule MusicLibrary.Wishlist do
alias MusicLibrary.Repo
alias MusicLibrary.Records
alias MusicLibrary.Records.Record
alias MusicLibrary.Records.SearchIndex
def search_records(query, opts \\ []) do
limit = Keyword.get(opts, :limit, 20)
@@ -31,7 +31,7 @@ defmodule MusicLibrary.Wishlist do
end
defp base_search do
from r in Record,
from r in SearchIndex,
where: is_nil(r.purchased_at)
end
end