From fa844e60cb7e5b7e43ab1479ff9015ad5c8df81a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 19 May 2023 12:44:08 -0400 Subject: [PATCH] Don't remove cnj on first term in Query. We might reorder them later. --- web/includes/Filter.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/includes/Filter.php b/web/includes/Filter.php index c4c9c69fa..37f3283d1 100644 --- a/web/includes/Filter.php +++ b/web/includes/Filter.php @@ -184,10 +184,11 @@ class Filter extends ZM_Object { } } - if ($this->{'Query'} and isset($this->{'Query'}['terms']) and count($this->{'Query'}['terms'])) { - # Unset cnj on first term, so that there's no leading AND - unset($this->{'Query'}['terms'][0]['cnj']); - } + # Disable this. We will do this on SQL generation + #if ($this->{'Query'} and isset($this->{'Query'}['terms']) and count($this->{'Query'}['terms'])) { + ## Unset cnj on first term, so that there's no leading AND + #unset($this->{'Query'}['terms'][0]['cnj']); + #} return $this->{'Query'}; } @@ -1177,6 +1178,9 @@ class Filter extends ZM_Object { foreach ($sort as $attr) { for ($i=0; $i < count($old_terms); $i++) { if ($old_terms[$i]['attr'] == $attr) { + if (!isset($old_terms[$i]['cnj'])) { + $old_terms[$i]['cnj'] = 'and'; + } $new_terms[] = $old_terms[$i]; array_splice($old_terms, $i, 1); $i--;