You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by be...@apache.org on 2024/02/26 07:31:55 UTC
(lucene) branch main updated: Fix test TestKnnByteVectorQuery.testToString (#13134)
This is an automated email from the ASF dual-hosted git repository.
benwtrent pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 6eba1fb537f Fix test TestKnnByteVectorQuery.testToString (#13134)
6eba1fb537f is described below
commit 6eba1fb537f84fc22e0ca5ff79de1fa453df45b1
Author: Shubham Chaudhary <36...@users.noreply.github.com>
AuthorDate: Mon Feb 26 13:01:49 2024 +0530
Fix test TestKnnByteVectorQuery.testToString (#13134)
Co-authored-by: Shubham Chaudhary <cs...@amazon.com>
---
.../src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java | 2 +-
.../src/test/org/apache/lucene/search/BaseKnnVectorQueryTestCase.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java b/lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java
index be69f800ba2..525156a2666 100644
--- a/lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java
@@ -442,7 +442,7 @@ abstract class AbstractKnnVectorQuery extends Query {
@Override
public String toString(String field) {
- return "DocAndScoreQuery[" + docs[0] + ",...][" + scores[0] + ",...]";
+ return "DocAndScoreQuery[" + docs[0] + ",...][" + scores[0] + ",...]," + maxScore;
}
@Override
diff --git a/lucene/core/src/test/org/apache/lucene/search/BaseKnnVectorQueryTestCase.java b/lucene/core/src/test/org/apache/lucene/search/BaseKnnVectorQueryTestCase.java
index 6e3f90fff59..5591a9059c9 100644
--- a/lucene/core/src/test/org/apache/lucene/search/BaseKnnVectorQueryTestCase.java
+++ b/lucene/core/src/test/org/apache/lucene/search/BaseKnnVectorQueryTestCase.java
@@ -842,8 +842,8 @@ abstract class BaseKnnVectorQueryTestCase extends LuceneTestCase {
// The string should contain matching docIds and their score.
// Since a forceMerge could occur in this test, we must not assert that a specific doc_id is
// matched
- // But that instead the string format is expected and that the score is 1.0
- assertTrue(queryString.matches("DocAndScoreQuery\\[\\d+,...]\\[1.0,...]"));
+ // But that instead the string format is expected and that the max score is 1.0
+ assertTrue(queryString.matches("DocAndScoreQuery\\[\\d+,...]\\[\\d+.\\d+,...],1.0"));
}
/**