Skip to content

Commit

Permalink
hopefully improve propagation of 'path eq hash' hint into 'in' statem…
Browse files Browse the repository at this point in the history
…ents

Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Sep 22, 2023
1 parent 4e08186 commit 63c7d16
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/private/Files/Search/QueryOptimizer/OrEqualsToIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public function processOperator(ISearchOperator &$operator): bool {
return $value;
}, $group);
$in = new SearchComparison(ISearchComparison::COMPARE_IN, $field, $values);
$in->setQueryHint(ISearchComparison::HINT_PATH_EQ_HASH, $group[0]->getQueryHint(ISearchComparison::HINT_PATH_EQ_HASH, true));
$pathEqHash = array_reduce($group, function($pathEqHash, ISearchComparison $comparison) {
return $comparison->getQueryHint(ISearchComparison::HINT_PATH_EQ_HASH, true) && $pathEqHash;
}, true);
$in->setQueryHint(ISearchComparison::HINT_PATH_EQ_HASH, $pathEqHash);
return $in;
} else {
return $group[0];
Expand Down Expand Up @@ -57,8 +60,7 @@ private function groupEqualsComparisonsByField(array $operators): array {
$result = [];
foreach ($operators as $operator) {
if ($operator instanceof ISearchComparison && $operator->getType() === ISearchComparison::COMPARE_EQUAL) {
$key = $operator->getField() . $operator->getQueryHint(ISearchComparison::HINT_PATH_EQ_HASH, true);
$result[$key][] = $operator;
$result[$operator->getField()][] = $operator;
} else {
$result[] = [$operator];
}
Expand Down

0 comments on commit 63c7d16

Please sign in to comment.