You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "bugmakerrrrrr (via GitHub)" <gi...@apache.org> on 2024/04/23 15:59:44 UTC

[PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

bugmakerrrrrr opened a new pull request, #13322:
URL: https://github.com/apache/lucene/pull/13322

   ### Description
   
   <!--
   If this is your first contribution to Lucene, please make sure you have reviewed the contribution guide.
   https://github.com/apache/lucene/blob/main/CONTRIBUTING.md
   -->
   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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "benwtrent (via GitHub)" <gi...@apache.org>.
benwtrent merged PR #13322:
URL: https://github.com/apache/lucene/pull/13322


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "bugmakerrrrrr (via GitHub)" <gi...@apache.org>.
bugmakerrrrrr commented on PR #13322:
URL: https://github.com/apache/lucene/pull/13322#issuecomment-2096390961

   > 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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "bugmakerrrrrr (via GitHub)" <gi...@apache.org>.
bugmakerrrrrr commented on PR #13322:
URL: https://github.com/apache/lucene/pull/13322#issuecomment-2144440261

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "benwtrent (via GitHub)" <gi...@apache.org>.
benwtrent commented on code in PR #13322:
URL: https://github.com/apache/lucene/pull/13322#discussion_r1624971924


##########
lucene/CHANGES.txt:
##########
@@ -399,6 +399,8 @@ Optimizations
 
 * GITHUB#13406: Replace List<Integer> by IntArrayList and List<Long> by LongArrayList. (Bruno Roustant)
 
+* GITHUB#13322: Implement Weight#count for vector values in the FieldExistsQuery. (Pan Guixin)
+

Review Comment:
   Since 9.11 has been cut, this needs moved to 9.12



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on code in PR #13322:
URL: https://github.com/apache/lucene/pull/13322#discussion_r1627993328


##########
lucene/core/src/java/org/apache/lucene/search/FieldExistsQuery.java:
##########
@@ -277,4 +276,20 @@ private String buildErrorMsg(FieldInfo fieldInfo) {
         + fieldInfo.name
         + "' exists and indexes neither of these data structures";
   }
+
+  private int getVectorValuesSize(FieldInfo fi, LeafReader reader) throws IOException {
+    assert fi.name.equals(field);
+    return switch (fi.getVectorEncoding()) {
+      case FLOAT32 -> {
+        FloatVectorValues floatVectorValues = reader.getFloatVectorValues(field);
+        assert floatVectorValues != null : "unexpected null float vector values";
+        yield floatVectorValues == null ? 0 : floatVectorValues.size();

Review Comment:
   Nit: can you remove the `null` check since vector values should never be null? FWIW I added a test case for this here: #13455.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13322:
URL: https://github.com/apache/lucene/pull/13322#issuecomment-2143642763

   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!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "bugmakerrrrrr (via GitHub)" <gi...@apache.org>.
bugmakerrrrrr commented on code in PR #13322:
URL: https://github.com/apache/lucene/pull/13322#discussion_r1625261750


##########
lucene/CHANGES.txt:
##########
@@ -399,6 +399,8 @@ Optimizations
 
 * GITHUB#13406: Replace List<Integer> by IntArrayList and List<Long> by LongArrayList. (Bruno Roustant)
 
+* GITHUB#13322: Implement Weight#count for vector values in the FieldExistsQuery. (Pan Guixin)
+

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "benwtrent (via GitHub)" <gi...@apache.org>.
benwtrent commented on PR #13322:
URL: https://github.com/apache/lucene/pull/13322#issuecomment-2075509191

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "benwtrent (via GitHub)" <gi...@apache.org>.
benwtrent commented on PR #13322:
URL: https://github.com/apache/lucene/pull/13322#issuecomment-2149930924

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Implement Weight#count for vector values in the FieldExistsQuery [lucene]

Posted by "bugmakerrrrrr (via GitHub)" <gi...@apache.org>.
bugmakerrrrrr commented on PR #13322:
URL: https://github.com/apache/lucene/pull/13322#issuecomment-2150212641

   @benwtrent done


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org