-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
For more details see https://issues.ibexa.co/browse/IBX-7418 and #61 Key changes: * Implemented criterion visitor for ContentName Criterion
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Solr\Query\Content\CriterionVisitor; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; | ||
use Ibexa\Contracts\Solr\Query\CriterionVisitor; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class ContentName extends CriterionVisitor | ||
{ | ||
public function canVisit(Criterion $criterion): bool | ||
{ | ||
return $criterion instanceof Criterion\ContentName | ||
&& $criterion->operator === Criterion\Operator::LIKE; | ||
} | ||
|
||
public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null): string | ||
{ | ||
/** @var string $value */ | ||
$value = $criterion->value; | ||
$searchField = 'meta_content__name_s'; | ||
|
||
return "{!edismax v='{$this->escapeQuote($value)}' qf='{$searchField}' uf=-*}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters