Skip to content

Commit

Permalink
add backwards compatible test for searchHit
Browse files Browse the repository at this point in the history
Signed-off-by: Dharin Shah <8616130+Dharin-shah@users.noreply.github.com>
  • Loading branch information
Dharin-shah committed Jan 28, 2024
1 parent 5b447e7 commit 09257a3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ public void testSerializationDeserializationWithMatchedQueriesScores() throws IO
assertEquals(searchHit.getMatchedQueriesAndScores(), deserializedSearchHit.getMatchedQueriesAndScores());
}

public void testSerializationDeserializationWithMatchedQueriesList() throws IOException {
SearchHit searchHit = createTestItem(true, true);
SearchHit deserializedSearchHit = copyWriteable(searchHit, getNamedWriteableRegistry(), SearchHit::new, Version.V_2_12_0);
assertEquals(searchHit, deserializedSearchHit);
assertEquals(searchHit.getMatchedQueriesAndScores(), deserializedSearchHit.getMatchedQueriesAndScores());
assertEquals(searchHit.getMatchedQueries(), deserializedSearchHit.getMatchedQueries());
}

/**
* When e.g. with "stored_fields": "_none_", only "_index" and "_score" are returned.
*/
Expand Down

0 comments on commit 09257a3

Please sign in to comment.