blob: 5259ca25ad30b5342576af0e45ef5bda7760854d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Files\Search\QueryOptimizer;
use OCP\Files\Search\ISearchOperator;
class QueryOptimizer {
/** @var QueryOptimizerStep[] */
private $steps = [];
public function __construct() {
// note that the order here is relevant
$this->steps = [
new PathPrefixOptimizer(),
new MergeDistributiveOperations(),
new FlattenSingleArgumentBinaryOperation(),
new FlattenNestedBool(),
new OrEqualsToIn(),
new FlattenNestedBool(),
new SplitLargeIn(),
];
}
public function processOperator(ISearchOperator &$operator) {
foreach ($this->steps as $step) {
$step->inspectOperator($operator);
}
foreach ($this->steps as $step) {
$step->processOperator($operator);
}
}
}
|