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 #276

Merged
merged 6 commits into from
Dec 5, 2023
Merged

IBX-6649: Added support for spell checking #276

merged 6 commits into from
Dec 5, 2023

Conversation

adamwojs
Copy link
Member

@adamwojs adamwojs commented Sep 28, 2023

Question Answer
JIRA issue IBX-6649
Type feature
Target Ibexa version v4.6
BC breaks no

Introduction

Added API to execute spell checking on search phrase and suggest potential alternatives for the user. Typical use case for this API is is "Did you mean X ?" functionality:

image

Similar feature implementation in Ibexa DXP:

Usage example

// "Ibexa Platfrom" is user input with typo
$input = "Ibexa Platfrom";

$query = new Query();
$query->query = new FullText($input);
$query->spellcheck = new Spellcheck($input);

$results = $searchService->findContent($query);

if ($results->spellcheck->isIncorrect()) {
    $suggestion = $results->getSpellcheck()->getQuery();

    // Display link with suggested search phrase 
} 

API changes summary

  • Introduced \Ibexa\Contracts\Core\Repository\Values\Content\Query\Spellcheck and \Ibexa\Contracts\Core\Repository\Values\Content\Search\SpellcheckResult classes
  • Deprecated \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult::$spellSuggestion property.
  • Changed \Ibexa\Contracts\Core\Repository\Values\Content\Query::$spellcheck property type from bool to \Ibexa\Contracts\Core\Repository\Values\Content\Query\Spellcheck|null.

Supported search engines

Spellcheck API is supported by solr and elasticsearch search engines. However suggestions might be differ between search engines and highly depends on search engine settings. More details in search engine specific PRs:

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (main for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping for example @ibexa/php-dev for back-end changes and/or @ibexa/javascript-dev for front-end changes).

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@adamwojs adamwojs marked this pull request as ready for review September 28, 2023 12:23
@konradoboza konradoboza requested a review from a team December 5, 2023 15:04
@adamwojs adamwojs merged commit 6190433 into main Dec 5, 2023
9 of 11 checks passed
@adamwojs adamwojs deleted the spellcheck branch December 5, 2023 22:50
Copy link

sonarqubecloud bot commented Dec 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants