lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruslan Muzhikov <rmuzhi...@gmail.com>
Subject Problems with toString at TermsQuery
Date Tue, 08 Sep 2015 14:35:09 GMT
Hi!
Sometimes TermsQuery.toString() method falls with exception:

*Exception in thread "main" java.lang.AssertionError*
* at org.apache.lucene.util.UnicodeUtil.UTF8toUTF16(UnicodeUtil.java:546)*
* at org.apache.lucene.util.BytesRef.utf8ToString(BytesRef.java:149)*
* at org.apache.lucene.queries.TermsQuery.toString(TermsQuery.java:190)*
* at org.apache.lucene.search.Query.toString(Query.java:67)*
* ...*


Here is the example of such program:

*public static void main(String[] args) {*
*    System.out.print(new TermsQuery(new Term("DATA", new
BytesRef(toBytes(128)))).toString());*
*}*

*public static byte[] toBytes(int val) {*
*    byte[] b = new byte[4];*
*    for(int i = 3; i > 0; i--) {*
*        b[i] = (byte) val;*
*        val >>>= 8;*
*    }*
*    b[0] = (byte) val;*
*    return b;*
*}*


Is there any limits on BytesRef content?

Thanks,
Ruslan Muzhikov

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message