-
Notifications
You must be signed in to change notification settings - Fork 100
Allow users to customize facet value sort behaviour #676
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
Conversation
Allow users to customize facet value sort behaviour
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes add support for configuring how facet values are sorted—either alphanumerically or by count—via a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SDK
participant Settings
participant FacetingSettings
User->>SDK: Call updateFaceting with sortFacetValuesBy
SDK->>Settings: with_sort_facet_values_by(BTreeMap)
Settings->>FacetingSettings: Update sort_facet_values_by field
FacetingSettings-->>Settings: Return updated settings
Settings-->>SDK: Return configured settings
SDK-->>User: Operation complete
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/settings.rs (1)
45-47
: Clarify the documentation comment for better accuracy.The comment could be more precise about what is being sorted.
- /// Customize facet order to sort by descending value count (count) or ascending alphanumeric order (alpha) + /// Customize how facet values are sorted: by descending count or ascending alphanumeric order.code-samples.meilisearch.yaml (2)
585-591
: Add theBTreeMap
import for copy-paste compilability.This snippet introduces
BTreeMap
but omits the correspondinguse std::collections::BTreeMap;
. Readers who paste the example verbatim will hit a compiler error.+use std::collections::BTreeMap;
1273-1278
: Same missing import as above.For consistency and to avoid compilation errors, prepend the snippet with
+use std::collections::BTreeMap;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.code-samples.meilisearch.yaml
(4 hunks)src/settings.rs
(5 hunks)
🧰 Additional context used
🧠 Learnings (2)
.code-samples.meilisearch.yaml (1)
Learnt from: LukasKalbertodt
PR: meilisearch/meilisearch-rust#625
File: src/search.rs:368-370
Timestamp: 2025-06-12T13:28:23.700Z
Learning: In the Meilisearch Rust client, `SearchQuery` serializes its per-query federation settings under the key `federationOptions`; only the top-level multi-search parameter is named `federation`.
src/settings.rs (1)
Learnt from: LukasKalbertodt
PR: meilisearch/meilisearch-rust#625
File: src/search.rs:368-370
Timestamp: 2025-06-12T13:28:23.700Z
Learning: In the Meilisearch Rust client, `SearchQuery` serializes its per-query federation settings under the key `federationOptions`; only the top-level multi-search parameter is named `federation`.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: integration-tests
🔇 Additional comments (5)
src/settings.rs (4)
33-38
: LGTM! Clean enum definition for facet sorting options.The
FacetSortValue
enum is well-structured with appropriate derive macros and clear variant names that match the intended functionality.
2351-2478
: Comprehensive test coverage for the new facet sorting functionality.The tests properly cover:
- Setting faceting with default sort behavior
- Explicit sort value configuration
- The API's behavior of returning default sort settings
- Various builder method combinations
Well done on the thorough testing!
1432-1435
: Example correctly updated to include the new field.The example appropriately demonstrates the new
sort_facet_values_by
field.
292-297
: Breaking change confirmed:with_faceting
now takes ownershipNo references to
with_faceting
were found in documentation (Markdown) outside of the implementation insrc/settings.rs
. The existing example insrc/settings.rs
already usesreq_faceting.clone()
, so no updates are required elsewhere..code-samples.meilisearch.yaml (1)
5-5
: Reference line – nothing to change.The added provenance comment is fine and needs no further action.
Pull Request
Rework of #514
Related issue
Fixes #502
What does this PR do?
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit