Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ API Changes

* GITHUB#15187: Restrict visibility of PerFieldKnnVectorsFormat.FieldsReader (Simon Cooper)

* GITHUB#15316: Remove FlatVectorsReader#getFlatVectorScorer and constructor parameter (Simon Cooper)

New Features
---------------------
* GITHUB#14097: Binary partitioning merge policy over float-valued vector field. (Mike Sokolov)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ final class Lucene99ScalarQuantizedVectorsReader extends FlatVectorsReader
private final IntObjectHashMap<FieldEntry> fields = new IntObjectHashMap<>();
private final IndexInput quantizedVectorData;
private final FlatVectorsReader rawVectorsReader;
private final FlatVectorsScorer vectorScorer;
private final FieldInfos fieldInfos;

Lucene99ScalarQuantizedVectorsReader(
SegmentReadState state, FlatVectorsReader rawVectorsReader, FlatVectorsScorer scorer)
throws IOException {
super(scorer);
this.rawVectorsReader = rawVectorsReader;
this.vectorScorer = scorer;
this.fieldInfos = state.fieldInfos;
int versionMeta = -1;
String metaFileName =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,6 @@
*/
public abstract class FlatVectorsReader extends KnnVectorsReader implements Accountable {

/** Scorer for flat vectors */
protected final FlatVectorsScorer vectorScorer;

/** Sole constructor */
protected FlatVectorsReader(FlatVectorsScorer vectorsScorer) {
this.vectorScorer = vectorsScorer;
}

/**
* @return the {@link FlatVectorsScorer} for this reader.
*/
public FlatVectorsScorer getFlatVectorScorer() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change that can't be back-ported -- do we think nobody would ever want to use this? Would we still provide the scorer for cases where we want to score vectors externally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing stopping subclasses from having a scorer, and exposing it, but this method is specifically not used in Lucene in the context of the general FlatVectorsReader

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change that can't be back-ported

This class is marked * @lucene.experimental. I thought that meant things could break?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I guess, but ... is it important to remove? I guess I'm thinkning of a case where a consumer wants to get a vector values and score against it to implement something like rescoring/ranking -- isn't this something we'd want to support? Or maybe I'm confused and this method is not needed for that use case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm thinkning of a case where a consumer wants to get a vector values and score against it to implement something like rescoring/ranking

[Float|Byte]VectorValues provides mechanisms for bulk scoring and bulk rescoring. But sure, I could still see this being used if folks had specialized logic.

return vectorScorer;
}

@Override
public void search(String field, float[] target, KnnCollector knnCollector, AcceptDocs acceptDocs)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class Lucene102BinaryQuantizedVectorsReader extends FlatVectorsReader {
FlatVectorsReader rawVectorsReader,
Lucene102BinaryFlatVectorsScorer vectorsScorer)
throws IOException {
super(vectorsScorer);
this.vectorScorer = vectorsScorer;
this.rawVectorsReader = rawVectorsReader;
int versionMeta = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class Lucene104ScalarQuantizedVectorsReader extends FlatVectorsReader
FlatVectorsReader rawVectorsReader,
Lucene104ScalarQuantizedVectorScorer vectorsScorer)
throws IOException {
super(vectorsScorer);
this.vectorScorer = vectorsScorer;
this.rawVectorsReader = rawVectorsReader;
int versionMeta = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,16 @@ public final class Lucene99FlatVectorsReader extends FlatVectorsReader {
private static final long SHALLOW_SIZE =
RamUsageEstimator.shallowSizeOfInstance(Lucene99FlatVectorsFormat.class);

private final FlatVectorsScorer vectorScorer;
private final IntObjectHashMap<FieldEntry> fields = new IntObjectHashMap<>();
private final IndexInput vectorData;
private final FieldInfos fieldInfos;
private final IOContext dataContext;

public Lucene99FlatVectorsReader(SegmentReadState state, FlatVectorsScorer scorer)
public Lucene99FlatVectorsReader(SegmentReadState state, FlatVectorsScorer vectorScorer)
throws IOException {
super(scorer);
int versionMeta = readMetadata(state);
this.vectorScorer = vectorScorer;
this.fieldInfos = state.fieldInfos;
// Flat formats are used to randomly access vectors from their node ID that is stored
// in the HNSW graph.
Expand Down
Loading