mirror of
https://github.com/nextcloud/server.git
synced 2025-02-07 09:59:46 +00:00
dae7c159f7
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
42 lines
1 KiB
PHP
42 lines
1 KiB
PHP
<?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\ISearchBinaryOperator;
|
|
use OCP\Files\Search\ISearchOperator;
|
|
|
|
class QueryOptimizerStep {
|
|
/**
|
|
* Allow optimizer steps to inspect the entire query before starting processing
|
|
*
|
|
* @param ISearchOperator $operator
|
|
* @return void
|
|
*/
|
|
public function inspectOperator(ISearchOperator $operator): void {
|
|
if ($operator instanceof ISearchBinaryOperator) {
|
|
foreach ($operator->getArguments() as $argument) {
|
|
$this->inspectOperator($argument);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Allow optimizer steps to modify query operators
|
|
*
|
|
* @param ISearchOperator $operator
|
|
* @return void
|
|
*/
|
|
public function processOperator(ISearchOperator &$operator) {
|
|
if ($operator instanceof ISearchBinaryOperator) {
|
|
foreach ($operator->getArguments() as $argument) {
|
|
$this->processOperator($argument);
|
|
}
|
|
}
|
|
}
|
|
}
|