Skip to content

Commit

Permalink
Add support for scored named queries (version updates) (opensearch-pr…
Browse files Browse the repository at this point in the history
…oject#12446)

Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta authored and Peter Alfonsi committed Mar 1, 2024
1 parent 012c8df commit 9190c39
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: "implemented for versions 3.0.0 and above"
version: " - 2.12.99"
reason: "implemented for versions 2.13.0 and above"

---
"matched queries":
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/org/opensearch/search/SearchHit.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public SearchHit(StreamInput in) throws IOException {
sortValues = new SearchSortValues(in);

size = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_13_0)) {
if (size > 0) {
Map<String, Float> tempMap = in.readMap(StreamInput::readString, StreamInput::readFloat);
matchedQueries = tempMap.entrySet()
Expand Down Expand Up @@ -269,7 +269,7 @@ public void writeTo(StreamOutput out) throws IOException {
sortValues.writeTo(out);

out.writeVInt(matchedQueries.size());
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_13_0)) {
if (!matchedQueries.isEmpty()) {
out.writeMap(matchedQueries, StreamOutput::writeString, StreamOutput::writeFloat);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public SearchSourceBuilder(StreamInput in) throws IOException {
searchPipelineSource = in.readMap();
}
}
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_13_0)) {
includeNamedQueriesScore = in.readOptionalBoolean();
}
}
Expand Down Expand Up @@ -347,7 +347,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeMap(searchPipelineSource);
}
}
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_13_0)) {
out.writeOptionalBoolean(includeNamedQueriesScore);
}
}
Expand Down

0 comments on commit 9190c39

Please sign in to comment.