mirror of https://github.com/apache/lucene.git
removing unnecessary changes
This commit is contained in:
parent
cb6ab5484e
commit
6d0cb4fe32
|
@ -706,59 +706,4 @@ final class IndexedDISI extends DocIdSetIterator {
|
||||||
disi.word = rankWord;
|
disi.word = rankWord;
|
||||||
disi.numberOfOnes = disi.denseOrigoIndex + denseNOO;
|
disi.numberOfOnes = disi.denseOrigoIndex + denseNOO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of a {@link DocIdSetIterator} which maps a source iterator to the indexes
|
|
||||||
* produced by an {@link IndexedDISI}.
|
|
||||||
*
|
|
||||||
* <p>This implementation assumes that all IDs produced by the source iterator are also present in
|
|
||||||
* the indexed iterator.
|
|
||||||
*
|
|
||||||
* @lucene.internal
|
|
||||||
*/
|
|
||||||
public static class MappedDISI extends DocIdSetIterator {
|
|
||||||
IndexedDISI indexedDISI;
|
|
||||||
DocIdSetIterator sourceDISI;
|
|
||||||
|
|
||||||
public MappedDISI(IndexedDISI indexedDISI, DocIdSetIterator sourceDISI) {
|
|
||||||
this.indexedDISI = indexedDISI;
|
|
||||||
this.sourceDISI = sourceDISI;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Advances the source iterator to the first document number that is greater than or equal to
|
|
||||||
* the provided target and returns the corresponding index.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int advance(int target) throws IOException {
|
|
||||||
int newTarget = sourceDISI.advance(target);
|
|
||||||
if (newTarget != NO_MORE_DOCS) {
|
|
||||||
indexedDISI.advance(newTarget);
|
|
||||||
}
|
|
||||||
return docID();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long cost() {
|
|
||||||
return this.sourceDISI.cost();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int docID() {
|
|
||||||
if (indexedDISI.docID() == NO_MORE_DOCS || sourceDISI.docID() == NO_MORE_DOCS) {
|
|
||||||
return NO_MORE_DOCS;
|
|
||||||
}
|
|
||||||
return indexedDISI.index();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Advances to the next document in the source iterator and returns the corresponding index. */
|
|
||||||
@Override
|
|
||||||
public int nextDoc() throws IOException {
|
|
||||||
int newTarget = sourceDISI.nextDoc();
|
|
||||||
if (newTarget != NO_MORE_DOCS) {
|
|
||||||
indexedDISI.advance(newTarget);
|
|
||||||
}
|
|
||||||
return docID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,11 +216,6 @@ abstract class OffHeapFloatVectorValues extends FloatVectorValues {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return new IndexedDISI.MappedDISI(disi, docIds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmptyOffHeapVectorValues extends OffHeapFloatVectorValues {
|
private static class EmptyOffHeapVectorValues extends OffHeapFloatVectorValues {
|
||||||
|
@ -268,10 +263,5 @@ abstract class OffHeapFloatVectorValues extends FloatVectorValues {
|
||||||
public VectorScorer scorer(float[] query) {
|
public VectorScorer scorer(float[] query) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return DocIdSetIterator.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,11 +230,6 @@ abstract class OffHeapByteVectorValues extends ByteVectorValues {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return new IndexedDISI.MappedDISI(disi, docIds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmptyOffHeapVectorValues extends OffHeapByteVectorValues {
|
private static class EmptyOffHeapVectorValues extends OffHeapByteVectorValues {
|
||||||
|
@ -282,10 +277,5 @@ abstract class OffHeapByteVectorValues extends ByteVectorValues {
|
||||||
public VectorScorer scorer(byte[] query) {
|
public VectorScorer scorer(byte[] query) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return DocIdSetIterator.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,11 +229,6 @@ abstract class OffHeapFloatVectorValues extends FloatVectorValues {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return new IndexedDISI.MappedDISI(disi, docIds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmptyOffHeapVectorValues extends OffHeapFloatVectorValues {
|
private static class EmptyOffHeapVectorValues extends OffHeapFloatVectorValues {
|
||||||
|
@ -281,10 +276,5 @@ abstract class OffHeapFloatVectorValues extends FloatVectorValues {
|
||||||
public VectorScorer scorer(float[] query) {
|
public VectorScorer scorer(float[] query) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return DocIdSetIterator.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,59 +758,4 @@ public final class IndexedDISI extends DocIdSetIterator {
|
||||||
disi.word = rankWord;
|
disi.word = rankWord;
|
||||||
disi.numberOfOnes = disi.denseOrigoIndex + denseNOO;
|
disi.numberOfOnes = disi.denseOrigoIndex + denseNOO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of a {@link DocIdSetIterator} which maps a source iterator to the indexes
|
|
||||||
* produced by an {@link IndexedDISI}.
|
|
||||||
*
|
|
||||||
* <p>This implementation assumes that all IDs produced by the source iterator are also present in
|
|
||||||
* the indexed iterator.
|
|
||||||
*
|
|
||||||
* @lucene.internal
|
|
||||||
*/
|
|
||||||
public static class MappedDISI extends DocIdSetIterator {
|
|
||||||
IndexedDISI indexedDISI;
|
|
||||||
DocIdSetIterator sourceDISI;
|
|
||||||
|
|
||||||
public MappedDISI(IndexedDISI indexedDISI, DocIdSetIterator sourceDISI) {
|
|
||||||
this.indexedDISI = indexedDISI;
|
|
||||||
this.sourceDISI = sourceDISI;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Advances the source iterator to the first document number that is greater than or equal to
|
|
||||||
* the provided target and returns the corresponding index.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int advance(int target) throws IOException {
|
|
||||||
int newTarget = sourceDISI.advance(target);
|
|
||||||
if (newTarget != NO_MORE_DOCS) {
|
|
||||||
indexedDISI.advance(newTarget);
|
|
||||||
}
|
|
||||||
return docID();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long cost() {
|
|
||||||
return this.sourceDISI.cost();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int docID() {
|
|
||||||
if (indexedDISI.docID() == NO_MORE_DOCS || sourceDISI.docID() == NO_MORE_DOCS) {
|
|
||||||
return NO_MORE_DOCS;
|
|
||||||
}
|
|
||||||
return indexedDISI.index();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Advances to the next document in the source iterator and returns the corresponding index. */
|
|
||||||
@Override
|
|
||||||
public int nextDoc() throws IOException {
|
|
||||||
int newTarget = sourceDISI.nextDoc();
|
|
||||||
if (newTarget != NO_MORE_DOCS) {
|
|
||||||
indexedDISI.advance(newTarget);
|
|
||||||
}
|
|
||||||
return docID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,11 +272,6 @@ public abstract class OffHeapByteVectorValues extends ByteVectorValues implement
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return new IndexedDISI.MappedDISI(disi, docIds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmptyOffHeapVectorValues extends OffHeapByteVectorValues {
|
private static class EmptyOffHeapVectorValues extends OffHeapByteVectorValues {
|
||||||
|
@ -327,10 +322,5 @@ public abstract class OffHeapByteVectorValues extends ByteVectorValues implement
|
||||||
public VectorScorer scorer(byte[] query) {
|
public VectorScorer scorer(byte[] query) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return DocIdSetIterator.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,11 +268,6 @@ public abstract class OffHeapFloatVectorValues extends FloatVectorValues impleme
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return new IndexedDISI.MappedDISI(disi, docIds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmptyOffHeapVectorValues extends OffHeapFloatVectorValues {
|
private static class EmptyOffHeapVectorValues extends OffHeapFloatVectorValues {
|
||||||
|
@ -318,10 +313,5 @@ public abstract class OffHeapFloatVectorValues extends FloatVectorValues impleme
|
||||||
public VectorScorer scorer(float[] query) {
|
public VectorScorer scorer(float[] query) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return DocIdSetIterator.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.lucene.index;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.lucene.document.KnnByteVectorField;
|
import org.apache.lucene.document.KnnByteVectorField;
|
||||||
import org.apache.lucene.search.DocIdSetIterator;
|
|
||||||
import org.apache.lucene.search.VectorScorer;
|
import org.apache.lucene.search.VectorScorer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,18 +64,6 @@ public abstract class ByteVectorValues extends KnnVectorValues {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new iterator that maps the provided docIds to the vector ordinals.
|
|
||||||
*
|
|
||||||
* <p>This method assumes that all docIds have corresponding ordinals.
|
|
||||||
*
|
|
||||||
* @lucene.internal
|
|
||||||
* @lucene.experimental
|
|
||||||
*/
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return docIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link VectorScorer} for the given query vector.
|
* Return a {@link VectorScorer} for the given query vector.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.lucene.index;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.lucene.document.KnnFloatVectorField;
|
import org.apache.lucene.document.KnnFloatVectorField;
|
||||||
import org.apache.lucene.search.DocIdSetIterator;
|
|
||||||
import org.apache.lucene.search.VectorScorer;
|
import org.apache.lucene.search.VectorScorer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,18 +64,6 @@ public abstract class FloatVectorValues extends KnnVectorValues {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new iterator that maps the provided docIds to the vector ordinals.
|
|
||||||
*
|
|
||||||
* <p>This method assumes that all docIds have corresponding ordinals.
|
|
||||||
*
|
|
||||||
* @lucene.internal
|
|
||||||
* @lucene.experimental
|
|
||||||
*/
|
|
||||||
public DocIdSetIterator convertDocIdsToVectorOrdinals(DocIdSetIterator docIds) {
|
|
||||||
return docIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link VectorScorer} for the given query vector and the current {@link
|
* Return a {@link VectorScorer} for the given query vector and the current {@link
|
||||||
* FloatVectorValues}.
|
* FloatVectorValues}.
|
||||||
|
|
Loading…
Reference in New Issue