hello,
i am using lucene 4.6. in my query i use a collector to get field values.
setNextReader is implemented as below.
public void setNextReader(AtomicReaderContext context) throws IOException {
cacheIDs = FieldCache.DEFAULT.getInts(context.reader(), "id", true);
}
and collect
public void collect(int docnr) throws IOException {
int id = 0;
id = cacheIDs .get(docnr);
...
}
But sometimes i got an exception like
2015-01-12 13:32:49,342 [ID:1e8e1dff-9a57-11e4-a697-c29020524153]ERROR (org.apache.lucene.search.join.Collector)
- Error getInts
java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.lucene.util.NumericUtils.getPrefixCodedIntShift(NumericUtils.java:208)
at org.apache.lucene.util.NumericUtils$2.accept(NumericUtils.java:493)
at org.apache.lucene.index.FilteredTermsEnum.next(FilteredTermsEnum.java:241)
at org.apache.lucene.search.FieldCacheImpl$Uninvert.uninvert(FieldCacheImpl.java:307)
at org.apache.lucene.search.FieldCacheImpl$IntCache.createValue(FieldCacheImpl.java:678)
at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:211)
at org.apache.lucene.search.FieldCacheImpl.getInts(FieldCacheImpl.java:570)
at org.apache.lucene.search.FieldCacheImpl$IntCache.createValue(FieldCacheImpl.java:631)
at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:211)
at org.apache.lucene.search.FieldCacheImpl.getInts(FieldCacheImpl.java:570)
at org.apache.lucene.search.FieldCacheImpl.getInts(FieldCacheImpl.java:545)
at org.apache.lucene.search.join.MyCollector.setNextReader(MyCollector.java:264)
when i try to get the field the normal way like this
Document doc = reader.document(docnr);
String sid = doc.get("id");
int id = Integer.parseInt(sid);
everything is fine.
am i doing something wrong?
regards
Sascha
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
|