Skip to content

Commit

Permalink
IBX-6649: Added support for spell checking
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Sep 28, 2023
1 parent 9b1fb5e commit 496702f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/QueryType/SearchQueryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\SectionTermAggregation;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentId;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Spellcheck;
use Ibexa\Contracts\Core\Repository\Values\User\User;
use Ibexa\Contracts\Search\SortingDefinition\SortingDefinitionRegistryInterface;
use Ibexa\Core\QueryType\OptionsResolverBasedQueryType;
Expand Down Expand Up @@ -42,6 +43,10 @@ protected function doGetQuery(array $parameters): Query
$query = new Query();
if (null !== $searchData->getQuery()) {
$query->query = new Criterion\FullText($searchData->getQuery());

if ($this->searchService->supports(SearchService::CAPABILITY_SPELLCHECK)) {
$query->spellcheck = new Spellcheck($searchData->getQuery());

Check failure on line 48 in src/lib/QueryType/SearchQueryType.php

View workflow job for this annotation

GitHub Actions / Run code style check (8.0)

Instantiated class Ibexa\Contracts\Core\Repository\Values\Content\Query\Spellcheck not found.

Check failure on line 48 in src/lib/QueryType/SearchQueryType.php

View workflow job for this annotation

GitHub Actions / Run code style check (8.0)

Property Ibexa\Contracts\Core\Repository\Values\Content\Query::$spellcheck (bool) does not accept Ibexa\Contracts\Core\Repository\Values\Content\Query\Spellcheck.
}
}

$criteria = $this->buildCriteria($searchData);
Expand Down
1 change: 1 addition & 0 deletions src/lib/View/SearchViewBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function buildView(array $parameters): SearchView
'results' => $this->pagerSearchContentToDataMapper->map($pagerfanta),
'pager' => $pagerfanta,
'aggregations' => $adapter->getAggregations(),
'spellcheck' => $adapter->getSpellcheck(),

Check failure on line 85 in src/lib/View/SearchViewBuilder.php

View workflow job for this annotation

GitHub Actions / Run code style check (8.0)

Call to an undefined method Ibexa\Core\Pagination\Pagerfanta\ContentSearchHitAdapter::getSpellcheck().
]);
}

Expand Down

0 comments on commit 496702f

Please sign in to comment.