Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kderusso committed Dec 5, 2024
1 parent bc7f735 commit 9b7b7d2
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public QueryBuilder rewrite(QueryRewriteContext context, QueryBuilder queryBuild
}
}

if (inferenceIndices.isEmpty() == false && nonInferenceIndices.isEmpty() == false) {
if (inferenceIndices.isEmpty()) {
return rewritten;
} else if (nonInferenceIndices.isEmpty() == false) {
BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
for (String inferenceIndexName : inferenceIndices) {
// Add a separate clause for each semantic query, because they may be using different inference endpoints
Expand All @@ -69,10 +71,11 @@ public QueryBuilder rewrite(QueryRewriteContext context, QueryBuilder queryBuild
createMatchSubQuery(nonInferenceIndices, matchQueryBuilder.fieldName(), matchQueryBuilder.value())
);
rewritten = boolQueryBuilder;
} else if (inferenceIndices.isEmpty() == false) {
} else {
rewritten = new SemanticQueryBuilder(matchQueryBuilder.fieldName(), (String) matchQueryBuilder.value(), true);
}
}

return rewritten;
}

Expand Down

0 comments on commit 9b7b7d2

Please sign in to comment.