lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Problem with sorting on NumericFields
Date Tue, 26 Oct 2010 07:29:38 GMT
This happens if your field still contains other value types in this field,
maybe from deleted documents. The problem is that even if no document
contains the old field encoding anymore, it could still be leftover terms in
terms index. So the FieldCache code loads the terms (even if no longer
documents are attached) and  tries to parse it. So if it was before a
different field type like a conventional plain text encoded numeric, the
parsing of those old terms fails. You should reindex the whole stuff or at
least try to optimize the index to get rid of deleted documents and the
terms.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Uwe Goetzke [mailto:uwe.goetzke@veenion.de]
> Sent: Monday, October 25, 2010 9:43 PM
> To: java-user@lucene.apache.org
> Subject: Problem with sorting on NumericFields
> 
> I got stuck on a problem using  NumericFields using with lucene 2.9.3
> 
> 
> 
> I add values  to the document by
> 
> doc.add(new NumericField("minprice").setDoubleValue(net_price));
> 
> 
> 
> If I want to search with a sorter for this field, I get this error:
> 
> 
> 
> java.lang.NumberFormatException: Invalid shift value in prefixCoded string
(is
> encoded value really an INT?)
> 
>                 at
> org.apache.lucene.util.NumericUtils.prefixCodedToInt(NumericUtils.java:2
> 33)
> 
>                 at
> org.apache.lucene.search.FieldCache$8.parseFloat(FieldCache.java:256)
> 
>                 at
> org.apache.lucene.search.FieldCacheImpl$FloatCache.createValue(FieldCach
> eImpl.java:514)
> 
>                 at
> org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:22
> 4)
> 
>                 at
> org.apache.lucene.search.FieldCacheImpl.getFloats(FieldCacheImpl.java:48
> 7)
> 
>                 at
> org.apache.lucene.search.FieldCacheImpl$FloatCache.createValue(FieldCach
> eImpl.java:504)
> 
>                 at
> org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:22
> 4)
> 
>                 at
> org.apache.lucene.search.FieldCacheImpl.getFloats(FieldCacheImpl.java:48
> 7)
> 
>                 at
> org.apache.lucene.search.FieldComparator$FloatComparator.setNextReader(F
> ieldComparator.java:269)
> 
>                 at
> org.apache.lucene.search.TopFieldCollector$MultiComparatorNonScoringColl
> ector.setNextReader(TopFieldCollector.java:435)
> 
>                 at
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:257)
> 
>                 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)
> 
> 
> 
> The Sort field as seen by the debugger:
> 
> *	sort_fields = {org.apache.lucene.search.SortField[1]@9010}
> *	[0] = {org.apache.lucene.search.SortField@9011}"!"
> *	field = {java.lang.String@8642}"minprice"
> *	type = 5
> *	locale = null
> *	reverse = true
> *	factory = null
> *	parser = null
> *	comparatorSource = null
> *	useLegacy = false
> 
> I run out of ideas what might go wrong. I did look at the index with luke
and I
> do not see anything special.
> 
> As this happens with the same code on other servers, too, It looks like
some
> kind of programming error.
> 
> Any hints?
> 
> Thx
> 
> 
> 
> Uwe
> 
> 



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