Skip to content

Commit

Permalink
Fixed unit test for neural query after recent knn change in rescore c…
Browse files Browse the repository at this point in the history
…ontext

Signed-off-by: Martin Gaievski <[email protected]>
  • Loading branch information
martin-gaievski committed Oct 9, 2024
1 parent 9f4a49a commit 1a9857e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.opensearch.knn.index.query.KNNQueryBuilder.MIN_SCORE_FIELD;
import static org.opensearch.knn.index.query.KNNQueryBuilder.RESCORE_FIELD;
import static org.opensearch.knn.index.query.KNNQueryBuilder.RESCORE_OVERSAMPLE_FIELD;
import static org.opensearch.neuralsearch.util.TestUtils.DELTA_FOR_SCORE_ASSERTION;
import static org.opensearch.neuralsearch.util.TestUtils.xContentBuilderToMap;
import static org.opensearch.neuralsearch.query.NeuralQueryBuilder.K_FIELD;
import static org.opensearch.neuralsearch.query.NeuralQueryBuilder.MODEL_ID_FIELD;
Expand Down Expand Up @@ -183,7 +184,11 @@ public void testFromXContent_withRescoreContext_thenBuildSuccessfully() {
assertEquals(QUERY_TEXT, neuralQueryBuilder.queryText());
assertEquals(MODEL_ID, neuralQueryBuilder.modelId());
assertEquals(K, neuralQueryBuilder.k());
assertEquals(RescoreContext.getDefault(), neuralQueryBuilder.rescoreContext());
assertEquals(
RescoreContext.getDefault().getOversampleFactor(),
neuralQueryBuilder.rescoreContext().getOversampleFactor(),
DELTA_FOR_SCORE_ASSERTION
);
assertNull(neuralQueryBuilder.methodParameters());
}

Expand Down

0 comments on commit 1a9857e

Please sign in to comment.