-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
776: Added Federation Parameter to multisearch method #768 r=curquiza a=Nsreddy18 # Pull Request ## Related issue Fixes #768 ## What does this PR do? - Adds a new parameter federation to the multiSearch method. - Introduces a new search parameter federationOptions to the search query. - Adds a getter method to the MultiSearchRequest class to retrieve the query list for creating the payload. - Adds a test to validate the new functionality. ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: nsreddy18 <nanavalasujeet@gmail.com>
- Loading branch information
Showing
6 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.meilisearch.sdk; | ||
|
||
import org.json.JSONObject; | ||
|
||
public class FederationOptions { | ||
|
||
private Double weight; | ||
|
||
public FederationOptions setWeight(Double weight) { | ||
this.weight = weight; | ||
return this; | ||
} | ||
|
||
/** | ||
* Method that returns the JSON String of the FederationOptions | ||
* | ||
* @return JSON String of the FederationOptions | ||
*/ | ||
@Override | ||
public String toString() { | ||
JSONObject jsonObject = new JSONObject().put("weight", this.weight); | ||
return jsonObject.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/meilisearch/sdk/MultiSearchFederation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.meilisearch.sdk; | ||
|
||
import org.json.JSONObject; | ||
|
||
public class MultiSearchFederation { | ||
|
||
private Integer limit; | ||
private Integer offset; | ||
|
||
public MultiSearchFederation setLimit(Integer limit) { | ||
this.limit = limit; | ||
return this; | ||
} | ||
|
||
public MultiSearchFederation setOffset(Integer offset) { | ||
this.offset = offset; | ||
return this; | ||
} | ||
|
||
public Integer getLimit() { | ||
return this.limit; | ||
} | ||
|
||
public Integer getOffset() { | ||
return this.offset; | ||
} | ||
|
||
/** | ||
* Method that returns the JSON String of the MultiSearchFederation | ||
* | ||
* @return JSON String of the MultiSearchFederation | ||
*/ | ||
@Override | ||
public String toString() { | ||
JSONObject jsonObject = | ||
new JSONObject().put("limit", this.limit).put("offset", this.offset); | ||
return jsonObject.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters