In my hibernate object, I have annotations set related to the data. They are mostly automatically generated (custom) by a translation done from an XML schema, so we end up with cases like this:
Code:
/* SORTING FAILS! */
@Column(name = "DateReceived")
@Fields( { @Field(index = Index.UN_TOKENIZED),
@Field(name = "SORT_DateReceived", index = Index.UN_TOKENIZED) })
/**
* A date field that comes across as a string
*/
private String DateReceived;
There are other fields that are like this:
Code:
/* SORTING WORKS! */
@Column(name = "VER")
@Fields( { @Field, @Field(name = "SORT_VER", index = Index.UN_TOKENIZED) })
private String VER;
In the latter case, sorting works just fine. When trying to sort the fields from the former case (SORT_DateReceived), I get an ArrayIndexOutOfBoundsException:
Code:
java.lang.ArrayIndexOutOfBoundsException: 2
at org.apache.lucene.search.FieldCacheImpl$StringIndexCache.createValue(FieldCacheImpl.java:721)
at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:224)
at org.apache.lucene.search.FieldCacheImpl.getStringIndex(FieldCacheImpl.java:692)
at org.apache.lucene.search.FieldComparator$StringOrdValComparator.setNextReader(FieldComparator.java:667)
at org.apache.lucene.search.TopFieldCollector$MultiComparatorNonScoringCollector.setNextReader(TopFieldCollector.java:435)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:249)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:240)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:181)
at org.apache.lucene.search.Searcher.search(Searcher.java:90)
at org.hibernate.search.query.QueryHits.updateTopDocs(QueryHits.java:110)
at org.hibernate.search.query.QueryHits.<init>(QueryHits.java:68)
at org.hibernate.search.query.FullTextQueryImpl.getQueryHits(FullTextQueryImpl.java:408)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:326)
...
...
There is a lot more to the stack trace, but... I can't for the life of me figure out what is causing this.