Skip to content

Commit

Permalink
refactor: renme DefaultQueryOperator to QueryOperator
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup committed Mar 20, 2024
1 parent 0a37638 commit ab87006
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* @codeCoverageIgnore
*/
enum DefaultQueryOperator: string
enum QueryOperator: string
{
case AND = 'AND';
case OR = 'OR';
Expand Down
2 changes: 1 addition & 1 deletion src/Dto/Search/Query/SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
public readonly array $sort,
public readonly array $filter,
public readonly array $facets,
public readonly DefaultQueryOperator $defaultQueryOperator
public readonly QueryOperator $defaultQueryOperator
) {
}
}
6 changes: 3 additions & 3 deletions src/Dto/Search/Query/SelectQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class SelectQueryBuilder
*/
private array $facets = [];

private DefaultQueryOperator $defaultQueryOperator =
DefaultQueryOperator::AND;
private QueryOperator $defaultQueryOperator =
QueryOperator::AND;

public function __construct()
{
Expand Down Expand Up @@ -105,7 +105,7 @@ public function facet(Facet ...$facetList): SelectQueryBuilder
}

public function defaultQueryOperator(
DefaultQueryOperator $defaultQueryOperator
QueryOperator $defaultQueryOperator
): SelectQueryBuilder {
$this->defaultQueryOperator = $defaultQueryOperator;
return $this;
Expand Down
6 changes: 3 additions & 3 deletions src/Service/Search/SolrSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Atoolo\Search\Service\Search;

use Atoolo\Search\Dto\Search\Query\DefaultQueryOperator;
use Atoolo\Search\Dto\Search\Query\Facet\FacetField;
use Atoolo\Search\Dto\Search\Query\Facet\FacetMultiQuery;
use Atoolo\Search\Dto\Search\Query\Facet\FacetQuery;
use Atoolo\Search\Dto\Search\Query\Filter\Filter;
use Atoolo\Search\Dto\Search\Query\QueryOperator;
use Atoolo\Search\Dto\Search\Query\SelectQuery;
use Atoolo\Search\Dto\Search\Query\Sort\Criteria;
use Atoolo\Search\Dto\Search\Query\Sort\Date;
Expand Down Expand Up @@ -148,9 +148,9 @@ static function ($term) use ($solrQuery) {

private function addQueryDefaultOperatorToSolrQuery(
SolrSelectQuery $solrQuery,
DefaultQueryOperator $operator
QueryOperator $operator
): void {
if ($operator === DefaultQueryOperator::OR) {
if ($operator === QueryOperator::OR) {
$solrQuery->setQueryDefaultOperator(
SolrSelectQuery::QUERY_OPERATOR_OR
);
Expand Down
6 changes: 3 additions & 3 deletions test/Dto/Search/Query/SelectQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Atoolo\Search\Test\Dto\Search\Query;

use Atoolo\Search\Dto\Search\Query\DefaultQueryOperator;
use Atoolo\Search\Dto\Search\Query\Facet\Facet;
use Atoolo\Search\Dto\Search\Query\Filter\Filter;
use Atoolo\Search\Dto\Search\Query\QueryOperator;
use Atoolo\Search\Dto\Search\Query\SelectQueryBuilder;
use Atoolo\Search\Dto\Search\Query\Sort\Criteria;
use InvalidArgumentException;
Expand Down Expand Up @@ -141,10 +141,10 @@ public function testSetTwoFacetSWithSameKey(): void

public function testSetQueryDefaultOperator(): void
{
$this->builder->defaultQueryOperator(DefaultQueryOperator::AND);
$this->builder->defaultQueryOperator(QueryOperator::AND);
$query = $this->builder->build();
$this->assertEquals(
DefaultQueryOperator::AND,
QueryOperator::AND,
$query->defaultQueryOperator,
'unexpected queryDefaultOperator'
);
Expand Down
22 changes: 11 additions & 11 deletions test/Service/Search/SolrSelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace Atoolo\Search\Test\Service\Search;

use Atoolo\Resource\Resource;
use Atoolo\Search\Dto\Search\Query\DefaultQueryOperator;
use Atoolo\Search\Dto\Search\Query\Facet\Facet;
use Atoolo\Search\Dto\Search\Query\Facet\FacetMultiQuery;
use Atoolo\Search\Dto\Search\Query\Facet\FacetQuery;
use Atoolo\Search\Dto\Search\Query\Facet\ObjectTypeFacet;
use Atoolo\Search\Dto\Search\Query\Filter\Filter;
use Atoolo\Search\Dto\Search\Query\QueryOperator;
use Atoolo\Search\Dto\Search\Query\SelectQuery;
use Atoolo\Search\Dto\Search\Query\Sort\Criteria;
use Atoolo\Search\Dto\Search\Query\Sort\Date;
Expand Down Expand Up @@ -93,7 +93,7 @@ public function testSelectEmpty(): void
],
[],
[],
DefaultQueryOperator::OR
QueryOperator::OR
);

$searchResult = $this->searcher->select($query);
Expand All @@ -116,7 +116,7 @@ public function testSelectWithText(): void
],
[],
[],
DefaultQueryOperator::OR
QueryOperator::OR
);

$searchResult = $this->searcher->select($query);
Expand Down Expand Up @@ -144,7 +144,7 @@ public function testSelectWithSort(): void
],
[],
[],
DefaultQueryOperator::OR
QueryOperator::OR
);

$searchResult = $this->searcher->select($query);
Expand All @@ -168,7 +168,7 @@ public function testSelectWithInvalidSort(): void
[$sort],
[],
[],
DefaultQueryOperator::OR
QueryOperator::OR
);

$this->expectException(InvalidArgumentException::class);
Expand All @@ -185,7 +185,7 @@ public function testSelectWithAndDefaultOperator(): void
[],
[],
[],
DefaultQueryOperator::AND
QueryOperator::AND
);

$searchResult = $this->searcher->select($query);
Expand All @@ -211,7 +211,7 @@ public function testSelectWithFilter(): void
[],
[$filter],
[],
DefaultQueryOperator::OR
QueryOperator::OR
);

$searchResult = $this->searcher->select($query);
Expand Down Expand Up @@ -244,7 +244,7 @@ public function testSelectWithFacets(): void
[],
[],
$facets,
DefaultQueryOperator::OR
QueryOperator::OR
);

$searchResult = $this->searcher->select($query);
Expand All @@ -271,7 +271,7 @@ public function testSelectWithInvalidFacets(): void
[],
[],
$facets,
DefaultQueryOperator::OR
QueryOperator::OR
);

$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -310,7 +310,7 @@ public function testResultFacets(): void
[],
[],
$facets,
DefaultQueryOperator::OR
QueryOperator::OR
);

$searchResult = $this->searcher->select($query);
Expand Down Expand Up @@ -353,7 +353,7 @@ public function testInvalidResultFacets(): void
[],
[],
$facets,
DefaultQueryOperator::OR
QueryOperator::OR
);

$this->expectException(InvalidArgumentException::class);
Expand Down

0 comments on commit ab87006

Please sign in to comment.