Skip to content

Commit

Permalink
Set NoMergePolicy for codec tests
Browse files Browse the repository at this point in the history
Sets NoMerge as merge policy for codec tests. This allows us to reliably
predict how many segments will be created.

Signed-off-by: John Mazanec <[email protected]>
  • Loading branch information
jmazanec15 committed Feb 8, 2023
1 parent 4de9f83 commit 7c49b23
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.common.collect.ImmutableSet;
import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
import org.apache.lucene.document.KnnVectorField;
import org.apache.lucene.index.NoMergePolicy;
import org.apache.lucene.index.VectorSimilarityFunction;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TopDocs;
Expand Down Expand Up @@ -121,6 +122,7 @@ public void testMultiFieldsKnnIndex(Codec codec) throws Exception {
IndexWriterConfig iwc = newIndexWriterConfig();
iwc.setMergeScheduler(new SerialMergeScheduler());
iwc.setCodec(codec);
iwc.setMergePolicy(NoMergePolicy.INSTANCE);

/**
* Add doc with field "test_vector"
Expand Down Expand Up @@ -223,6 +225,7 @@ public void testBuildFromModelTemplate(Codec codec) throws IOException, Executio
IndexWriterConfig iwc = newIndexWriterConfig();
iwc.setMergeScheduler(new SerialMergeScheduler());
iwc.setCodec(codec);
iwc.setMergePolicy(NoMergePolicy.INSTANCE);

FieldType fieldType = new FieldType(KNNVectorFieldMapper.Defaults.FIELD_TYPE);
fieldType.putAttribute(KNNConstants.MODEL_ID, modelId);
Expand Down Expand Up @@ -317,6 +320,7 @@ public void testKnnVectorIndex(
IndexWriterConfig iwc = newIndexWriterConfig();
iwc.setMergeScheduler(new SerialMergeScheduler());
iwc.setCodec(codec);
iwc.setMergePolicy(NoMergePolicy.INSTANCE);

/**
* Add doc with field "test_vector_one"
Expand Down

0 comments on commit 7c49b23

Please sign in to comment.