Skip to content

Commit 4e32971

Browse files
committed
Add javadoc
1 parent e2ab4bc commit 4e32971

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lucene/core/src/java/org/apache/lucene/search/TwoPhaseKnnVectorQuery.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,32 @@
1919
import java.io.IOException;
2020
import java.util.Arrays;
2121
import java.util.Objects;
22+
import org.apache.lucene.document.KnnFloatVectorField;
2223
import org.apache.lucene.index.FieldInfo;
2324
import org.apache.lucene.index.FloatVectorValues;
2425
import org.apache.lucene.index.LeafReaderContext;
2526
import org.apache.lucene.search.knn.KnnCollectorManager;
2627
import org.apache.lucene.util.ArrayUtil;
2728
import org.apache.lucene.util.Bits;
2829

30+
/** A subclass of KnnFloatVectorQuery which does oversampling and full-precision reranking. */
2931
public class TwoPhaseKnnVectorQuery extends KnnFloatVectorQuery {
3032

3133
private final int originalK;
3234
private final double oversample;
3335

36+
/**
37+
* Find the <code>k</code> nearest documents to the target vector according to the vectors in the
38+
* given field. <code>target</code> vector. It also over-samples by oversample parameter and does
39+
* full precision reranking if oversample > 0
40+
*
41+
* @param field a field that has been indexed as a {@link KnnFloatVectorField}.
42+
* @param target the target of the search
43+
* @param k the number of documents to find
44+
* @param oversample the oversampling factor, a value of 0 means no oversampling
45+
* @param filter a filter applied before the vector search
46+
* @throws IllegalArgumentException if <code>k</code> is less than 1
47+
*/
3448
public TwoPhaseKnnVectorQuery(
3549
String field, float[] target, int k, double oversample, Query filter) {
3650
super(field, target, k + (int) Math.round(k * oversample), filter);

0 commit comments

Comments
 (0)