Skip to content

Commit

Permalink
refactor: changed api to withOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
adilansari committed Aug 12, 2022
1 parent 6c65b67 commit 21d9412
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public Builder withFacetQuery(FacetQuery facetQuery) {
* @param sortOrder {@link SortingOrder}
* @return {@link SearchRequest.Builder}
*/
public Builder withSortingOrder(SortingOrder sortOrder) {
public Builder withSort(SortingOrder sortOrder) {
this.sortOrder = sortOrder;
return this;
}
Expand All @@ -233,7 +233,7 @@ public Builder withSortingOrder(SortingOrder sortOrder) {
* @param orders {@link TigrisSort}
* @return {@link SearchRequest.Builder}
*/
public Builder withSortingOrders(TigrisSort... orders) {
public Builder withSort(TigrisSort... orders) {
this.sortOrder = SortingOrder.newBuilder().withOrder(orders).build();
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ public void toSearchRequest() {

@Test
public void toSearchRequest_withSortOrder() {
SearchRequest input =
SearchRequest.newBuilder().withSortingOrders(Sort.descending("field_1")).build();
SearchRequest input = SearchRequest.newBuilder().withSort(Sort.descending("field_1")).build();
Api.SearchRequest apiSearchRequest =
TypeConverter.toSearchRequest(DB_NAME, COLLECTION_NAME, input, null, DEFAULT_OBJECT_MAPPER);
Assert.assertNotNull(apiSearchRequest.getSort());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void build() {
.withFacetQuery(expectedFacetQuery)
.withFilter(expectedFilter)
.withIncludeFields(expectedIncludeFields.get(0))
.withSortingOrder(expectedSortingOrder)
.withSort(expectedSortingOrder)
.build();

Assert.assertNotNull(actual);
Expand All @@ -69,7 +69,7 @@ public void buildWithVarargs() {
.withFacetFields("field_3")
.withExcludeFields("field_4", "field_5")
.withIncludeFields("field_6")
.withSortingOrders(expectedSort)
.withSort(expectedSort)
.build();
Assert.assertEquals(expectedQuery, actual.getQuery());
Assert.assertEquals(expectedSearchFields, actual.getSearchFields());
Expand Down

0 comments on commit 21d9412

Please sign in to comment.