vigyasharma commented on code in PR #14676:
URL: https://github.com/apache/lucene/pull/14676#discussion_r2093986452


##########
lucene/CHANGES.txt:
##########
@@ -49,6 +49,9 @@ Bug Fixes
 
 * GITHUB#14075: Remove duplicate and add missing entry on brazilian portuguese 
stopwords list. (Arthur Caccavo)
 
+* GITHUB#14161: PointInSetQuery's constructor now throws 
IllegalArgumentException

Review Comment:
   We can put this in 10.3, doesn't need to wait for 11.0



##########
lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java:
##########
@@ -2599,4 +2599,33 @@ public void 
testPointInSetQuerySkipsNonMatchingSegments() throws IOException {
     w.close();
     dir.close();
   }
+
+  public void testOutOfOrderValuesInPointInSetQuery() throws Exception {

Review Comment:
   Thanks for adding this test!



##########
lucene/core/src/java/org/apache/lucene/util/BytesRefBuilder.java:
##########
@@ -171,4 +171,9 @@ public boolean equals(Object obj) {
   public int hashCode() {
     throw new UnsupportedOperationException();
   }
+
+  @Override
+  public String toString() {
+    return this.get().toString();

Review Comment:
   This will return hex encoded bytes. Is that okay for the exception message? 
Should we use `utf8ToString` instread?



##########
lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java:
##########
@@ -2599,4 +2599,33 @@ public void 
testPointInSetQuerySkipsNonMatchingSegments() throws IOException {
     w.close();
     dir.close();
   }
+
+  public void testOutOfOrderValuesInPointInSetQuery() throws Exception {
+    IllegalArgumentException expected =
+        expectThrows(
+            IllegalArgumentException.class,
+            () -> {
+              new PointInSetQuery(
+                  "foo",
+                  1,
+                  1,
+                  new PointInSetQuery.Stream() {
+                    private final BytesRef[] values = {
+                      newBytesRef(new byte[] {2}), newBytesRef(new byte[] {1}) 
// out of order
+                    };
+                    int index = 0;
+
+                    @Override
+                    public BytesRef next() {
+                      return index < values.length ? values[index++] : null;
+                    }
+                  }) {
+                @Override
+                protected String toString(byte[] point) {

Review Comment:
   Why did we need this override?



-- 
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-unsubscr...@lucene.apache.org

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


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

Reply via email to