Skip to content

Commit

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

Signed-off-by: John Mazanec <[email protected]>
  • Loading branch information
jmazanec15 authored Feb 14, 2023
1 parent 5b06cfe commit b8f2deb
Showing 1 changed file with 3 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,8 @@ public void testMultiFieldsKnnIndex(Codec codec) throws Exception {
IndexWriterConfig iwc = newIndexWriterConfig();
iwc.setMergeScheduler(new SerialMergeScheduler());
iwc.setCodec(codec);
// Set merge policy to no merges so that we create a predictable number of segments.
iwc.setMergePolicy(NoMergePolicy.INSTANCE);

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

0 comments on commit b8f2deb

Please sign in to comment.