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]>
(cherry picked from commit b8f2deb)
  • Loading branch information
jmazanec15 authored and github-actions[bot] committed Feb 14, 2023
1 parent 24706a9 commit 5634c0b
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 @@ -109,6 +110,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 5634c0b

Please sign in to comment.