From 535abec2289151fa370d7c9fe532b88d45949e46 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 14 Mar 2021 05:28:57 -0700 Subject: [PATCH] Oops, fix manually NC condition! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Oops, we weren't doing a good job encapsulating the different conditions in item search. The `OR` in the NC condition was causing a precedence problem! Now, we wrap all the conditions in parens at the interpolation site, to make it really clear that they all need to be made safe like that! Now, there's not a bunch of "??????" entries in NC search, oops 😅 --- src/server/loaders.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/server/loaders.js b/src/server/loaders.js index 8c3b8192..1986029d 100644 --- a/src/server/loaders.js +++ b/src/server/loaders.js @@ -339,10 +339,9 @@ const buildItemSearchLoader = (db, loaders) => `; const queryConditions = ` - ${matcherPlaceholders} AND t.locale = "en" AND - ${bodyIdCondition} AND - ${zoneIdsCondition} AND ${itemKindCondition} AND - ${currentUserCondition} + (${matcherPlaceholders}) AND t.locale = "en" AND + (${bodyIdCondition}) AND (${zoneIdsCondition}) AND + (${itemKindCondition}) AND (${currentUserCondition}) `; const queryConditionValues = [ ...wordMatchersForMysql,