mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
add extra flatten step to improve "or eq" -> "in" optimization
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
63ffaab95e
commit
1c87cee5ad
2 changed files with 4 additions and 3 deletions
|
|
@ -35,6 +35,7 @@ class QueryOptimizer {
|
|||
new PathPrefixOptimizer(),
|
||||
new MergeDistributiveOperations(),
|
||||
new FlattenSingleArgumentBinaryOperation(),
|
||||
new FlattenNestedBool(),
|
||||
new OrEqualsToIn(),
|
||||
new FlattenNestedBool(),
|
||||
new SplitLargeIn(),
|
||||
|
|
|
|||
|
|
@ -83,16 +83,16 @@ class OrEqualsToInTest extends TestCase {
|
|||
ISearchBinaryOperator::OPERATOR_OR,
|
||||
[
|
||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
|
||||
new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "foo%"),
|
||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
|
||||
new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "asd%"),
|
||||
]
|
||||
);
|
||||
$this->assertEquals('(path eq "foo" or path eq "bar" or path like "asd%")', $operator->__toString());
|
||||
$this->assertEquals('(path eq "foo" or path like "foo%" or path eq "bar")', $operator->__toString());
|
||||
|
||||
$this->optimizer->processOperator($operator);
|
||||
$this->simplifier->processOperator($operator);
|
||||
|
||||
$this->assertEquals('(path in ["foo","bar"] or path like "asd%")', $operator->__toString());
|
||||
$this->assertEquals('(path in ["foo","bar"] or path like "foo%")', $operator->__toString());
|
||||
}
|
||||
|
||||
public function testOrsInside() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue