From 95164cd97760dcbce87034a9f6274b4fbcecf4d5 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Thu, 26 Sep 2024 16:32:01 +0100 Subject: [PATCH] Make search match all artists attribute Ignores the fact that artists is a JSON structure - just treats it as a giant piece of text. --- lib/music_library/records.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/music_library/records.ex b/lib/music_library/records.ex index 18387efc..08ab6b8a 100644 --- a/lib/music_library/records.ex +++ b/lib/music_library/records.ex @@ -23,7 +23,7 @@ defmodule MusicLibrary.Records do q = from r in Record, - where: like(r.title, ^"%#{query}%") or like(r.artists[0]["name"], ^"%#{query}%"), + where: like(r.title, ^"%#{query}%") or like(r.artists, ^"%#{query}%"), order_by: [r.artists[0]["sort_name"], r.title], limit: ^limit, offset: ^offset