-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TwoPhaseKnnVectorQuery #29
base: main
Are you sure you want to change the base?
Conversation
dd8f079
to
96d2987
Compare
cf3e558
to
a06f980
Compare
a06f980
to
e2ab4bc
Compare
33c5fcd
to
ccd3e25
Compare
* | ||
* @lucene.experimental | ||
*/ | ||
public class TwoPhaseKnnVectorQuery extends KnnFloatVectorQuery { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we would need a brand new query that doesn't build on top of AbstractKnnVectorQuery. Instead, gets passed the desired knn query as a parameter & the desired target then the outer reranking query can call the knn
query via rewrite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's a cleaner idea actually. Let me try it in next rev.
for (int i = 0; i < NUM_VECTORS; i++) { | ||
float[] vector = randomFloatVector(VECTOR_DIMENSION, random); | ||
Document doc = new Document(); | ||
doc.add(new IntField("id", i, Field.Store.YES)); | ||
doc.add(new KnnFloatVectorField(FIELD, vector, VECTOR_SIMILARITY_FUNCTION)); | ||
writer.addDocument(doc); | ||
vectors.put(i, vector); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should flush the writers a few time to create more than one segments, this make sure the code path that results are merged from multiple segments are executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points, I added the flush() and uncovered/fixed a bug with doc ord.
d9f331f
to
8cd3ccf
Compare
Description
Draft for two-phase vector search (see apache#13564). Created a new Query for sake of simplicity.