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

EZP-32107: Added Score sort clause #130

Merged
merged 4 commits into from
Nov 4, 2020
Merged

EZP-32107: Added Score sort clause #130

merged 4 commits into from
Nov 4, 2020

Conversation

adamwojs
Copy link
Member

@adamwojs adamwojs commented Oct 27, 2020

Question Answer
JIRA issue EZP-32107
Type feature
Target eZ Platform version v3.3
BC breaks no
Doc needed yes

Added \eZ\Publish\API\Repository\Values\Content\Query\SortClause\Score which allows explicitly define sorting by relevance score. Typical use case for \eZ\Publish\API\Repository\Values\Content\Query\SortClause\Score is composition of multiple sort clauses:

$query = new Query([
    'query' => new Criterion\FullText('foo'),
    'sortClauses' => [
        new SortClause\Score(Query::SORT_DESC),
        // Sort results alphabetically in case of equal relevance score
        new SortClause\ContentName(),
    ],
]);

\eZ\Publish\API\Repository\Values\Content\Query\SortClause\Score by engines which are capable of scoring results (Solr and ES)

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (master for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ezsystems/php-dev-team).

Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok. I have code analysis related request. While this might seem unimportant, the reason for doing such changes is DX of future updates. We either can disable a rule or follow it strictly, so when code analysis reports an issue I know it comes from my code, not from the past changes.

@adamwojs
Copy link
Member Author

adamwojs commented Nov 2, 2020

PR updated according to code review suggestions.

@sonarcloud
Copy link

sonarcloud bot commented Nov 2, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@mnocon mnocon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with ES and Solr, looks good!

@adamwojs adamwojs merged commit 500e270 into master Nov 4, 2020
@adamwojs adamwojs deleted the ezp_32107 branch November 4, 2020 11:06
ViniTou pushed a commit to ViniTou/ezplatform-kernel that referenced this pull request Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Feature New feature or request QA approved
4 participants