Skip to content

Commit

Permalink
Dropped Tokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Jan 17, 2024
1 parent 3bff05c commit 3d6f190
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
25 changes: 1 addition & 24 deletions src/lib/Query/Content/CriterionVisitor/ContentName.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,12 @@

use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Solr\Query\CriterionVisitor;
use QueryTranslator\Languages\Galach\Generators\ExtendedDisMax;
use QueryTranslator\Languages\Galach\Parser;
use QueryTranslator\Tokenizing;

/**
* @internal
*/
final class ContentName extends CriterionVisitor
{
private Tokenizing $tokenizer;

private Parser $parser;

private ExtendedDisMax $generator;

public function __construct(
Tokenizing $tokenizer,
Parser $parser,
ExtendedDisMax $generator
) {
$this->tokenizer = $tokenizer;
$this->parser = $parser;
$this->generator = $generator;
}

public function canVisit(Criterion $criterion): bool
{
return $criterion instanceof Criterion\ContentName
Expand All @@ -45,12 +26,8 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
{
/** @var string $value */
$value = $criterion->value;
$tokenSequence = $this->tokenizer->tokenize($value);
$syntaxTree = $this->parser->parse($tokenSequence);

$queryString = $this->generator->generate($syntaxTree);
$searchField = 'meta_content__name_s';

return "{!edismax v='{$this->escapeQuote($queryString)}' qf='{$searchField}' uf=-*}";
return "{!edismax v='{$this->escapeQuote($value)}' qf='{$searchField}' uf=-*}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ services:
- {name: ibexa.search.solr.query.content.criterion.visitor}

Ibexa\Solr\Query\Content\CriterionVisitor\ContentName:
arguments:
$tokenizer: '@ibexa.solr.query.query_translator.galach.tokenizer'
$parser: '@ibexa.solr.query.query_translator.galach.parser'
$generator: '@ibexa.solr.query.query_translator.galach.generator.edismax'
tags:
- {name: ibexa.search.solr.query.content.criterion.visitor}
- {name: ibexa.search.solr.query.location.criterion.visitor}
Expand Down

0 comments on commit 3d6f190

Please sign in to comment.