Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-6649: Added support for spell checking #32

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
$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
5 changes: 4 additions & 1 deletion src/lib/View/SearchViewBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@
$pagerfanta->setMaxPerPage($data->getLimit());
$pagerfanta->setCurrentPage(min($data->getPage(), $pagerfanta->getNbPages()));

$results = $this->pagerSearchContentToDataMapper->map($pagerfanta);

$view->addParameters([
'results' => $this->pagerSearchContentToDataMapper->map($pagerfanta),
'results' => $results,
'pager' => $pagerfanta,
'aggregations' => $adapter->getAggregations(),
'spellcheck' => $adapter->getSpellcheck(),

Check failure on line 87 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
Loading