You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "jhinch-at-atlassian-com (via GitHub)" <gi...@apache.org> on 2025/01/22 23:20:04 UTC

[I] UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order [lucene]

jhinch-at-atlassian-com opened a new issue, #14161:
URL: https://github.com/apache/lucene/issues/14161

   ### Description
   
   PointInSetQuery in its constructor will check if the values provided to it are in order and if not will attempt to throw an exception:
   
   ```
             throw new IllegalArgumentException(
                 "values are out of order: saw " + previous + " before " + current);
   ```
   
   However instead of this exception, the following exception is thrown:
   
   ```
   java.lang.UnsupportedOperationException
   	at org.apache.lucene.util.BytesRefBuilder.hashCode(BytesRefBuilder.java:172)
   	at java.base/java.lang.Object.toString(Object.java:256)
   	at java.base/java.lang.StringConcatHelper.stringOf(StringConcatHelper.java:453)
   	at org.apache.lucene.search.PointInSetQuery.<init>(PointInSetQuery.java:116)
   ```
   
   This is because `previous` is a `BytesRefBuilder` which does not support the `hashCode()` method which is used by the default `toString()` method.
   
   Either `BytesRefBuilder` should be updated to allow for `toString()` to be invoked on it or the code should be modified to retrieve the `BytesRef` within the `BytesRefBuilder` so that the correct exception is thrown
   
   ### Version and environment details
   
   * JDK 21
   * Lucene 9.11.1


-- 
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.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: [I] UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order [lucene]

Posted by "jhinch-at-atlassian-com (via GitHub)" <gi...@apache.org>.
jhinch-at-atlassian-com commented on issue #14161:
URL: https://github.com/apache/lucene/issues/14161#issuecomment-2611152321

   Having `BytesRefBuilder#toString` delegate to its underlying buffer or calling `BytesRefBuilder#get` within `PointInSetQuery` both seem like reasonable options.


-- 
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: [I] UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order [lucene]

Posted by "romseygeek (via GitHub)" <gi...@apache.org>.
romseygeek closed issue #14161: UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order
URL: https://github.com/apache/lucene/issues/14161


-- 
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: [I] UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order [lucene]

Posted by "gsmiller (via GitHub)" <gi...@apache.org>.
gsmiller commented on issue #14161:
URL: https://github.com/apache/lucene/issues/14161#issuecomment-2610240868

   Oh gross. Good catch! It seems like the desire in this exception message is to print out the `previous` bytes ref in the same was as `current`. I wonder if we should implement `BytesRefBuilder#toString` to delegate to its underlying `ref` buffer?


-- 
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: [I] UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order [lucene]

Posted by "romseygeek (via GitHub)" <gi...@apache.org>.
romseygeek commented on issue #14161:
URL: https://github.com/apache/lucene/issues/14161#issuecomment-3324526536

   Fixed by https://github.com/apache/lucene/pull/14676


-- 
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: [I] UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order [lucene]

Posted by "jhinch-at-atlassian-com (via GitHub)" <gi...@apache.org>.
jhinch-at-atlassian-com commented on issue #14161:
URL: https://github.com/apache/lucene/issues/14161#issuecomment-2620096721

   I should be able to contribute a PR. Just need to finalise details around the CLA and then I will raise a PR


-- 
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: [I] UnsupportedOperationException instead of IllegalArgumentException from PointInSetQuery when values are out of order [lucene]

Posted by "gsmiller (via GitHub)" <gi...@apache.org>.
gsmiller commented on issue #14161:
URL: https://github.com/apache/lucene/issues/14161#issuecomment-2612934639

   @jhinch-at-atlassian-com agreed. I might lean towards implementing a `BytesRefBuilder#toString` method since it could potentially help in other places where this trappy behavior might happen. Do you have any interest in opening a pull request? I'd be happy to review it.


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