fix(types): allow interface{} for FacetSearchRequest Filter (fixes #752)#753
Conversation
Adds support for Meilisearch v1.35.0 showPerformanceDetails option: - Add ShowPerformanceDetails field to SearchRequest struct - Add ShowPerformanceDetails field to SimilarDocumentQuery struct - Add PerformanceDetails field to SearchResponse as json.RawMessage - Add unit tests for JSON marshaling/unmarshaling The performanceDetails response field is returned as raw JSON data as specified in the issue requirements, since the object fields are subject to change in future Meilisearch versions. Fixes meilisearch#749
Fixes meilisearch#752 Change Filter type in FacetSearchRequest from string to interface{} to allow passing slice of strings for complex filter queries, consistent with SearchRequest.
📝 WalkthroughWalkthroughThis PR adds support for array-based filters in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #753 +/- ##
===========================================
- Coverage 88.53% 11.32% -77.21%
===========================================
Files 22 40 +18
Lines 3262 25498 +22236
===========================================
Hits 2888 2888
- Misses 216 22452 +22236
Partials 158 158 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@kyyril |
…quest Filter - Remove types_facet_search_test.go - Add integration test case for []string filter in TestIndex_FacetSearch
There was a problem hiding this comment.
@kyyril
These unit tests do not add value to our coverage please remove them.
ElyarSadig
left a comment
There was a problem hiding this comment.
Please apply the changes reuquested.
Summary
This PR fixes #752.
Problem:
FacetSearchRequest.Filterwas defined asstring, preventing users from directly passing array/slice filters (e.g.[]string{"cat", "dog"}), which are supported by Meilisearch API for AND/OR logic.Solution: Changed
FacetSearchRequest.Filtertype tointerface{}to matchSearchRequest.Filter, allowing both string and slice inputs.Technical Details
types.go,types_facet_search_test.goChanges Made
Filterfield inFacetSearchRequeststruct fromstringtointerface{}.types_facet_search_test.goto verify correct marshaling of both string and slice filters.Verification
Test Results
[]string).string).Quality Checklist
Summary by CodeRabbit
New Features
Tests