Don't remove cnj on first term in Query. We might reorder them later.

pull/3710/head
Isaac Connor 2023-05-19 12:44:08 -04:00
parent e0c5382825
commit fa844e60cb
1 changed files with 8 additions and 4 deletions

View File

@ -184,10 +184,11 @@ class Filter extends ZM_Object {
} }
} }
if ($this->{'Query'} and isset($this->{'Query'}['terms']) and count($this->{'Query'}['terms'])) { # Disable this. We will do this on SQL generation
# Unset cnj on first term, so that there's no leading AND #if ($this->{'Query'} and isset($this->{'Query'}['terms']) and count($this->{'Query'}['terms'])) {
unset($this->{'Query'}['terms'][0]['cnj']); ## Unset cnj on first term, so that there's no leading AND
} #unset($this->{'Query'}['terms'][0]['cnj']);
#}
return $this->{'Query'}; return $this->{'Query'};
} }
@ -1177,6 +1178,9 @@ class Filter extends ZM_Object {
foreach ($sort as $attr) { foreach ($sort as $attr) {
for ($i=0; $i < count($old_terms); $i++) { for ($i=0; $i < count($old_terms); $i++) {
if ($old_terms[$i]['attr'] == $attr) { if ($old_terms[$i]['attr'] == $attr) {
if (!isset($old_terms[$i]['cnj'])) {
$old_terms[$i]['cnj'] = 'and';
}
$new_terms[] = $old_terms[$i]; $new_terms[] = $old_terms[$i];
array_splice($old_terms, $i, 1); array_splice($old_terms, $i, 1);
$i--; $i--;