apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.45k stars 975 forks source link

Implement Weight#count for vector values in the FieldExistsQuery #13322

Closed bugmakerrrrrr closed 3 weeks ago

bugmakerrrrrr commented 2 months ago

Description

Considering only one vector value can be indexed per doc, we can use the Float/ByteVectorValues#size method to implement Weight#count for vector values in the FieldExistsQuery

benwtrent commented 2 months ago

I like this. Could you add an entry under "Optimizations" in "CHANGES.txt"?

bugmakerrrrrr commented 1 month ago

I don't remember how vectors handle ghost fields, could this trigger a NPE if a field indexes vectors, then all docs that have vectors get merged away?

The test shows that vectors will return a empty instance for ghost fields, but for safety reasons, I added a null checks.

This looks like something that could go into 9.11, let's move the CHANGES entry under 9.11?

Done.

github-actions[bot] commented 4 weeks ago

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

bugmakerrrrrr commented 4 weeks ago

@jpountz could you please take a look when you get a chance

benwtrent commented 3 weeks ago

@bugmakerrrrrr Once you handle the conflicts, I can merge and backport. I think this is ready to go unless @jpountz has any outstanding concerns.

bugmakerrrrrr commented 3 weeks ago

@benwtrent done