Skip to content

Commit

Permalink
Changes in tests to adapt with builder pattern in querybuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Jain <[email protected]>
  • Loading branch information
vibrantvarun committed Jan 8, 2025
1 parent ca81c58 commit 962fbaa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.opensearch.neuralsearch.util.TestUtils.getModelId;

import org.opensearch.index.query.QueryBuilder;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.knn.index.query.rescore.RescoreContext;
import org.opensearch.neuralsearch.query.HybridQueryBuilder;
import org.opensearch.neuralsearch.query.NeuralQueryBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ public void testDoToQuery_whenPaginationDepthIsGreaterThan10000_thenBuildSuccess
IndexSettings indexSettings = new IndexSettings(indexMetadata, settings);
when(mockQueryShardContext.getIndexSettings()).thenReturn(indexSettings);

NeuralQueryBuilder neuralQueryBuilder = new NeuralQueryBuilder().fieldName(VECTOR_FIELD_NAME)
NeuralQueryBuilder neuralQueryBuilder = NeuralQueryBuilder.builder()
.fieldName(VECTOR_FIELD_NAME)
.queryText(QUERY_TEXT)
.modelId(MODEL_ID)
.k(K)
.vectorSupplier(TEST_VECTOR_SUPPLIER);
.vectorSupplier(TEST_VECTOR_SUPPLIER)
.build();

queryBuilder.add(neuralQueryBuilder);
IllegalArgumentException exception = expectThrows(
Expand Down Expand Up @@ -270,11 +272,13 @@ public void testDoToQuery_whenPaginationDepthIsLessThanZero_thenBuildSuccessfull
IndexSettings indexSettings = new IndexSettings(indexMetadata, settings);
when(mockQueryShardContext.getIndexSettings()).thenReturn(indexSettings);

NeuralQueryBuilder neuralQueryBuilder = new NeuralQueryBuilder().fieldName(VECTOR_FIELD_NAME)
NeuralQueryBuilder neuralQueryBuilder = NeuralQueryBuilder.builder()
.fieldName(VECTOR_FIELD_NAME)
.queryText(QUERY_TEXT)
.modelId(MODEL_ID)
.k(K)
.vectorSupplier(TEST_VECTOR_SUPPLIER);
.vectorSupplier(TEST_VECTOR_SUPPLIER)
.build();

queryBuilder.add(neuralQueryBuilder);
IllegalArgumentException exception = expectThrows(
Expand Down

0 comments on commit 962fbaa

Please sign in to comment.