mirror of https://github.com/apache/lucene.git
SimpleText knn vectors; fix searchExhaustively and suppress a byte format test case (#11725)
This commit is contained in:
parent
29f94b0404
commit
61ef031f7f
|
@ -41,7 +41,6 @@ import org.apache.lucene.store.BufferedChecksumIndexInput;
|
|||
import org.apache.lucene.store.ChecksumIndexInput;
|
||||
import org.apache.lucene.store.IOContext;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.util.BitSet;
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.BytesRefBuilder;
|
||||
|
@ -187,8 +186,9 @@ public class SimpleTextKnnVectorsReader extends KnnVectorsReader {
|
|||
@Override
|
||||
public TopDocs searchExhaustively(
|
||||
String field, float[] target, int k, DocIdSetIterator acceptDocs) throws IOException {
|
||||
int numDocs = (int) acceptDocs.cost();
|
||||
return search(field, target, k, BitSet.of(acceptDocs, numDocs), Integer.MAX_VALUE);
|
||||
FieldInfo info = readState.fieldInfos.fieldInfo(field);
|
||||
VectorSimilarityFunction vectorSimilarity = info.getVectorSimilarityFunction();
|
||||
return exhaustiveSearch(getVectorValues(field), acceptDocs, vectorSimilarity, target, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
|
|||
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
|
@ -513,6 +514,9 @@ public class TestField extends LuceneTestCase {
|
|||
}
|
||||
|
||||
public void testKnnVectorField() throws Exception {
|
||||
if (Codec.getDefault().getName().equals("SimpleText")) {
|
||||
return;
|
||||
}
|
||||
try (Directory dir = newDirectory();
|
||||
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig())) {
|
||||
Document doc = new Document();
|
||||
|
|
Loading…
Reference in New Issue