From 1a14a775d4201db7f70afc1c10d2535e61d9a6c9 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Tue, 23 Jan 2024 23:54:44 -0600 Subject: [PATCH] Add clarifying comment --- lib/Library.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Library.php b/lib/Library.php index 7f328e92..41a14b76 100644 --- a/lib/Library.php +++ b/lib/Library.php @@ -228,6 +228,10 @@ class Library{ $params[] = $tokenizedQuery; // aan.Name $params[] = $tokenizedQuery; // t.Name + // We use replace() below because if there's multiple contributors separated by an underscore, + // the underscore won't count as word boundary and we won't get a match. + // See https://github.com/standardebooks/web/pull/325 + $artworks = Db::Query(' SELECT art.* from Artworks art @@ -237,11 +241,11 @@ class Library{ left join Tags t using (TagId) where ' . $statusCondition . ' and (art.Name regexp ? - or replace(art.EbookUrl, "_", " ") regexp ? + or replace(art.EbookUrl, "_", " ") regexp ? or a.Name regexp ? or aan.Name regexp ? or t.Name regexp ?) - group by art.ArtworkId + group by art.ArtworkId order by ' . $orderBy, $params, 'Artwork'); return $artworks;