Skip to content

Add sampledCount faceting sort value - #1005

Open
Pratham2511 wants to merge 1 commit into
meilisearch:mainfrom
Pratham2511:codex/sampled-count-1004
Open

Pratham2511 wants to merge 1 commit into
meilisearch:mainfrom
Pratham2511:codex/sampled-count-1004

Conversation

@Pratham2511

@Pratham2511 Pratham2511 commented Oct 27, 2026 •

Copy link
Copy Markdown

Pull Request

Related issue

Fixes #1004

What does this PR do?

  • Add FacetSortValue.SAMPLED_COUNT with the sampledCount JSON value.
  • Cover Gson/Jackson serialization and wildcard/named-facet update/read/reset, and update the requested code sample.

AI disclosure: OpenAI Codex assisted with implementation, regression tests, source inspection, local validation and this description. Human review is pending while this PR is a draft.

Validation

On Temurin 17, the default test task passes 119/119 candidate tests and 113/113 base tests; build, formatting, lint and coverage pass. All 5 faceting integration cases pass on Meilisearch 1.56.0. With the setup audited and CI's build-before-integration order, 225/239 candidate integrations and 223/237 unchanged-base integrations pass, with the same 14 failures. The full integration gate remains failed.

The existing Gradle integrationTest task reports NO-SOURCE without a local source/classpath override. These are native local results; exact Docker execution was unavailable. Which supported server/API baseline should these existing integration expectations target?

PR checklist

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Summary by CodeRabbit

  • New Features
    • Added sampled-count sorting for facets, allowing facet values to be ordered by their estimated counts. This option is available for individual attributes and wildcard facet settings.
  • Bug Fixes
    • Updated the facet sorting example to use sampled-count sorting. Existing count and alphabetical sorting options remain available.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 38c76292-7f3d-4316-a9d5-12d5579ee792
Commits

Reviewing files that changed from the base of the PR and between 76c96b3 and 8b5a538.

Files selected for processing: 4
  • .code-samples.meilisearch.yaml
  • src/main/java/com/meilisearch/sdk/model/FacetSortValue.java
  • src/test/java/com/meilisearch/integration/SettingsTest.java
  • src/test/java/com/meilisearch/sdk/model/FacetingTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The SDK adds SAMPLED_COUNT with the serialized value sampledCount. Tests cover JSON serialization and deserialization, faceting settings updates and resets, and the updated code sample.

Changes: Sampled-count facet sorting

Layer / File(s) Summary
Sort value and serialization coverage
src/main/java/com/meilisearch/sdk/model/FacetSortValue.java, src/test/java/com/meilisearch/sdk/model/FacetingTest.java, .code-samples.meilisearch.yaml
The enum adds SAMPLED_COUNT, serialized as sampledCount. Model tests cover serialization and deserialization. The genres example uses the new value.
Faceting settings integration
src/test/java/com/meilisearch/integration/SettingsTest.java
A parameterized test checks sampled-count sorting for wildcard and genres settings, reads the updated settings, and verifies reset behavior.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: serendipty01

Merge Risk: Minimal · up to 8b5a5

The new setting has test coverage, but the standard CI integration task currently skips it.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add sampledCount faceting sort value" matches the main change. The PR adds the SAMPLED_COUNT enum value to FacetSortValue, serialized as "sampledCount", and adds tests and a code-sample upd…
Linked Issues check Passed Issue #1004 requires the sampledCount sort value, serialization support, faceting update/get/reset coverage, wildcard and per-attribute tests, and a code sample. FacetSortValue.SAMPLED_COUNT seria…
Out of Scope Changes check Passed The changed files support Issue #1004 directly: the enum adds the required value, tests cover serialization and faceting settings behavior, and the code sample documents the new value. No unrelated pr…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title "Add sampledCount faceting sort value" matches the main change. The PR adds the SAMPLED_COUNT enum value to FacetSortValue, serialized as "sampledCount", and adds tests and a code-sample update for faceting sort. The title is concise, specific, and names the primary change from the developer's perspective.

Full details: Linked Issues check

Explanation

Issue #1004 requires the sampledCount sort value, serialization support, faceting update/get/reset coverage, wildcard and per-attribute tests, and a code sample. FacetSortValue.SAMPLED_COUNT serializes as sampledCount. FacetingTest covers Gson, Jackson, custom Jackson mapping, and Settings deserialization. The integration test covers faceting update, readback through faceting and general settings, and reset for wildcard and genres cases. The update_faceting_settings_1 sample uses * with ALPHA and genres with SAMPLED_COUNT.

Full details: Out of Scope Changes check

Explanation

The changed files support Issue #1004 directly: the enum adds the required value, tests cover serialization and faceting settings behavior, and the code sample documents the new value. No unrelated product behavior or unrelated files are identified. The reported integration failures do not demonstrate an out-of-scope change because the same failures occur in the unchanged base results.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files. (1 skipped: 1 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Pratham2511

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pratham2511
Pratham2511 marked this pull request as ready for review October 28, 2026 08:04
Copilot AI balanced review requested due to automatic review settings October 28, 2026 08:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

This branch has not been deployed

No deployments
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.

[Meilisearch v1.56] Add support for sampledCount in faceting sortFacetValuesBy

2 participants