Skip to content

Commit 4e1d7fd

Browse files
committed
Handle null values for "hybrid" in IndexSearchRequest and fix test class name
1 parent fbd8ccc commit 4e1d7fd

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/main/java/com/meilisearch/sdk/IndexSearchRequest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,12 @@ public String toString() {
110110
.putOpt("attributesToSearchOn", this.attributesToSearchOn)
111111
.putOpt("locales", this.locales)
112112
.putOpt("distinct", this.distinct)
113-
.putOpt("retrieveVectors", this.retrieveVectors);
114-
115-
if (this.hybrid != null) {
116-
jsonObject.put("hybrid", this.hybrid.toJSONObject());
117-
}
113+
.putOpt("retrieveVectors", this.retrieveVectors)
114+
.putOpt(
115+
"hybrid",
116+
this.hybrid != null
117+
? this.hybrid.toJSONObject() :
118+
null);
118119

119120
return jsonObject.toString();
120121
}

src/test/java/com/meilisearch/sdk/IndexSearchRequestTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import static org.hamcrest.Matchers.equalTo;
88
import static org.hamcrest.Matchers.is;
99

10-
class IndexIndexSearchRequestTest {
10+
class IndexSearchRequestTest {
1111
@Test
1212
void toStringWithHybridUsingBuilder() {
1313
IndexSearchRequest classToTest =

0 commit comments

Comments
 (0)