lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sascha Janz" <Sascha.J...@gmx.net>
Subject Aw: Re: trouble with Collector and FieldCache
Date Thu, 15 Jan 2015 14:03:36 GMT
they are all stored like this

 

Field fid = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED, Field.TermVector.NO);
fid.setStringValue(Integer.toString(id));

 

because of reusing fid i have to set the value this way.
 

Gesendet: Donnerstag, 15. Januar 2015 um 13:12 Uhr
Von: "Ian Lea" <ian.lea@gmail.com>
An: java-user@lucene.apache.org
Betreff: Re: trouble with Collector and FieldCache
How are you storing the id field? A wild guess might be that this
error might be caused by having some documents with id stored,
perhaps, as a StringField or TextField and some as an IntField.


--
Ian.


On Wed, Jan 14, 2015 at 2:07 PM, Sascha Janz <Sascha.Janz@gmx.net> wrote:
>
> 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
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message