diff --git a/src/lib/QueryType/SearchQueryType.php b/src/lib/QueryType/SearchQueryType.php index 7bca8cc..0a205f6 100644 --- a/src/lib/QueryType/SearchQueryType.php +++ b/src/lib/QueryType/SearchQueryType.php @@ -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; @@ -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()); + } } $criteria = $this->buildCriteria($searchData); diff --git a/src/lib/View/SearchViewBuilder.php b/src/lib/View/SearchViewBuilder.php index 702b918..de7b984 100644 --- a/src/lib/View/SearchViewBuilder.php +++ b/src/lib/View/SearchViewBuilder.php @@ -82,6 +82,7 @@ public function buildView(array $parameters): SearchView 'results' => $this->pagerSearchContentToDataMapper->map($pagerfanta), 'pager' => $pagerfanta, 'aggregations' => $adapter->getAggregations(), + 'spellcheck' => $adapter->getSpellcheck(), ]); }