Skip to content

Commit

Permalink
test commit
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Jain <[email protected]>
  • Loading branch information
vibrantvarun committed Jan 14, 2025
1 parent ecedf35 commit 739096b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public HybridQuery(final Collection<Query> subQueries, final List<Query> filterQ
if (subQueries.isEmpty()) {
throw new IllegalArgumentException("collection of queries must not be empty");
}
if (hybridQueryContext.getPaginationDepth() == 0) {
if (hybridQueryContext.getPaginationDepth() != null && hybridQueryContext.getPaginationDepth() == 0) {
throw new IllegalArgumentException("pagination_depth must not be zero");
}
if (Objects.isNull(filterQueries) || filterQueries.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,8 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
queryBuilder.toXContent(builder, params);
}
builder.endArray();
if (isClusterOnOrAfterMinReqVersionForPaginationInHybridQuery()) {
builder.field(
PAGINATION_DEPTH_FIELD.getPreferredName(),
(paginationDepth == null || paginationDepth == 0) ? DEFAULT_PAGINATION_DEPTH : paginationDepth
);
if (Objects.nonNull(paginationDepth)) {
builder.field(PAGINATION_DEPTH_FIELD.getPreferredName(), paginationDepth);
}
printBoostAndQueryName(builder);
builder.endObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@

import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;

/**
* Class that holds the low level information of hybrid query in the form of context
*/
@Builder
@Getter
public class HybridQueryContext {
@NonNull
private int paginationDepth;
private Integer paginationDepth;
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testQueryBasics_whenMultipleDifferentQueries_thenSuccessful() {
countOfQueries++;
}
assertEquals(2, countOfQueries);
assertEquals(10, query3.getQueryContext().getPaginationDepth());
assertEquals(10, query3.getQueryContext().getPaginationDepth().intValue());
}

@SneakyThrows
Expand Down

0 comments on commit 739096b

Please sign in to comment.