-
Notifications
You must be signed in to change notification settings - Fork 102
Add exhaustive facet search #726
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdded optional exhaustive facet counting: Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client code
participant Builder as SearchQuery builder
participant HTTP as HTTP layer
participant Server as Meilisearch server
rect rgb(240,248,255)
Client->>Builder: create SearchQuery
Builder->>Builder: with_exhaustive_facet_count(true)
end
rect rgb(245,255,240)
Builder->>HTTP: serialize query (includes exhaustiveFacetCount)
HTTP->>Server: POST /search { ..., "exhaustiveFacetCount": true }
Server-->>HTTP: 200 OK { ..., "exhaustiveFacetCount": true, "facetsDistribution": {...} }
HTTP-->>Client: deserialize -> SearchResults.exhaustive_facet_count = Some(true)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
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: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/search.rs(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-12T13:28:23.700Z
Learnt from: LukasKalbertodt
Repo: meilisearch/meilisearch-rust PR: 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`.
Applied to files:
src/search.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #726 +/- ##
==========================================
- Coverage 86.18% 86.13% -0.06%
==========================================
Files 20 20
Lines 6263 6305 +42
==========================================
+ Hits 5398 5431 +33
- Misses 865 874 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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: 0
🧹 Nitpick comments (1)
src/search.rs (1)
1992-2026: Strengthen the test assertion to verify the actual value.The test correctly handles forward compatibility by accepting
BadRequesterrors from servers that don't support this field yet. However, when the field is present, the test only verifies it'sSome(...)without checking the actual boolean value.Apply this diff to verify the returned value matches the request:
match res { Ok(results) => { - assert!(results.exhaustive_facet_count.is_some()); + assert_eq!(results.exhaustive_facet_count, Some(true), + "Expected exhaustive_facet_count to be Some(true) when requested"); Ok(()) }This ensures the server actually honors the request rather than just returning any value.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/search.rs(6 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-12T13:28:23.700Z
Learnt from: LukasKalbertodt
Repo: meilisearch/meilisearch-rust PR: 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`.
Applied to files:
src/search.rs
🧬 Code graph analysis (1)
src/search.rs (3)
src/client.rs (4)
None(1446-1446)None(1525-1525)index(424-426)new(54-66)src/indexes.rs (26)
client(186-188)client(232-234)client(320-322)client(376-378)client(428-430)client(473-475)client(522-525)client(556-558)client(634-636)client(700-702)client(970-972)client(1038-1040)client(1089-1091)client(1133-1135)client(1186-1188)client(1245-1247)index(2171-2171)index(2188-2189)index(2226-2226)index(2298-2298)index(2326-2326)index(2352-2352)index(2379-2379)new(81-89)new(1783-1790)new(1994-2000)src/documents.rs (8)
index(62-64)index(161-161)index(350-350)index(487-487)setup_test_index(423-451)new(89-94)new(209-218)new(367-372)
⏰ 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 (6)
src/search.rs (6)
118-120: LGTM! Field correctly implements exhaustive facet count in search results.The field name, type, and documentation are appropriate. With the struct-level
#[serde(rename_all = "camelCase")]attribute, this will correctly serialize/deserialize asexhaustiveFacetCount.
414-419: LGTM! Query parameter correctly configured for exhaustive facet counting.The field is properly configured with serde attributes to skip serialization when unset, and the documentation clearly explains its purpose and default behavior.
466-466: LGTM! Proper initialization in constructor.The field is correctly initialized to
None, consistent with other optional query parameters.
735-742: LGTM! Builder method correctly implements the pattern.The method follows the established builder pattern and is consistent with the existing
FacetSearchQuery::with_exhaustive_facet_countmethod.
1113-1113: LGTM! Import required for the new test.The
ErrorCodeimport is needed for error handling in thetest_search_with_exhaustive_facet_counttest.
2028-2048: LGTM! Excellent serialization test.This unit test provides valuable verification that the field serializes to the correct camelCase name
exhaustiveFacetCount, which is critical for API compatibility with Meilisearch v1.14. The test would catch any naming regressions.
Pull Request
Related issue
Fixes #664
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