-
Notifications
You must be signed in to change notification settings - Fork 129
Support "Hybrid" parameter in IndexSearchRequest to enable multi search with hybrid search
#904
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
WalkthroughAdds a protected Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Test as Test
participant Req as IndexSearchRequest
participant Hybrid as Hybrid
Note over Test,Req: Build or instantiate IndexSearchRequest (may include Hybrid)
Test->>Req: call toString()
alt hybrid != null
Req->>Hybrid: hybrid.toJSONObject()
Hybrid-->>Req: JSONObject (embedder, semanticRatio, ...)
Req-->>Test: JSON string includes "hybrid": JSONObject
else hybrid == null
Req-->>Test: JSON string includes "hybrid": null
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/meilisearch/sdk/IndexSearchRequest.java(3 hunks)src/test/java/com/meilisearch/sdk/IndexSearchRequestTest.java(1 hunks)
🔇 Additional comments (5)
src/main/java/com/meilisearch/sdk/IndexSearchRequest.java (2)
3-3: LGTM!The import is necessary for the new hybrid field and follows the existing import pattern.
42-42: LGTM!The field declaration is consistent with other protected fields in the class, and the Lombok annotations will automatically generate the necessary getters and setters.
src/test/java/com/meilisearch/sdk/IndexSearchRequestTest.java (3)
11-26: Verify test expectations match actual JSON output.This test validates the builder pattern and getter methods. The getter assertions (lines 24-25) are good practice. However, the expected JSON string at line 20 may not match the actual output due to the serialization concerns flagged in
IndexSearchRequest.java(lines 115-117).Specifically:
- The expected string contains only
qandhybridfields- The actual output will likely include additional fields like
offset,limit, etc., withnullvalues due to the.put()calls in thetoString()methodThis concern is addressed by the verification script in the previous review comment for
IndexSearchRequest.java.
28-45: Field ordering in expected JSON may not match actual output.The expected JSON string at line 43 shows the field order as
q,hybrid,offset,limit. However, in the implementation (IndexSearchRequest.javalines 115-117),hybridis added after all other fields, so the actual output will havehybridat the end, not betweenqandoffset.This concern is addressed by the verification script in the review comment for
IndexSearchRequest.java(lines 115-117).
47-56: Good test coverage for partial Hybrid configuration.This test validates the scenario where only the
embedderis set (withoutsemanticRatio), which is valuable for ensuring partial configuration works correctly. The use of constructor and setter methods (instead of builder) also provides good test coverage.However, the same JSON output concerns apply here as in the other tests (see comments for lines 11-26 and 28-45).
…responding tests according to spotless
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/meilisearch/sdk/IndexSearchRequest.java(3 hunks)src/test/java/com/meilisearch/sdk/IndexSearchRequestTest.java(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/test/java/com/meilisearch/sdk/IndexSearchRequestTest.java
🔇 Additional comments (3)
src/main/java/com/meilisearch/sdk/IndexSearchRequest.java (3)
3-3: LGTM!The import is necessary for the new
Hybridfield and follows the existing import structure.
42-42: LGTM!The field declaration follows the established pattern for protected optional fields in this class.
50-50: LGTM!The Javadoc update correctly documents the default value of the new
hybridfield.
Pull Request
Related issue
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
New Features
Tests