Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 52628 invoked from network); 26 Oct 2010 07:47:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Oct 2010 07:47:36 -0000 Received: (qmail 55914 invoked by uid 500); 26 Oct 2010 07:47:34 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 55321 invoked by uid 500); 26 Oct 2010 07:47:30 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Delivered-To: moderator for java-user@lucene.apache.org Received: (qmail 41933 invoked by uid 99); 26 Oct 2010 07:35:09 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: AW: Problem with sorting on NumericFields X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Tue, 26 Oct 2010 09:34:25 +0200 Message-ID: In-Reply-To: <01f701cb74df$8bf724f0$a3e56ed0$@thetaphi.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problem with sorting on NumericFields Thread-Index: AQEzmxqCrLP9FtpfT2jlE+EqKC+dDJSCh+EQgAABpYA= References: <01f701cb74df$8bf724f0$a3e56ed0$@thetaphi.de> From: "Uwe Goetzke" To: Thx Uwe, after sleeping over the problem... The solution just hit me ;) I index a double for the Numeric field but my Sortfield was setup as a = float. (Maybe this is something for a FAQ for NumericFields) Thx Uwe -----Urspr=FCngliche Nachricht----- Von: Uwe Schindler [mailto:uwe@thetaphi.de]=20 Gesendet: Dienstag, 26. Oktober 2010 09:30 An: java-user@lucene.apache.org Betreff: RE: Problem with sorting on NumericFields 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 >=20 > I got stuck on a problem using NumericFields using with lucene 2.9.3 >=20 >=20 >=20 > I add values to the document by >=20 > doc.add(new NumericField("minprice").setDoubleValue(net_price)); >=20 >=20 >=20 > If I want to search with a sorter for this field, I get this error: >=20 >=20 >=20 > java.lang.NumberFormatException: Invalid shift value in prefixCoded = string (is > encoded value really an INT?) >=20 > at > = org.apache.lucene.util.NumericUtils.prefixCodedToInt(NumericUtils.java:2 > 33) >=20 > at > org.apache.lucene.search.FieldCache$8.parseFloat(FieldCache.java:256) >=20 > at > = org.apache.lucene.search.FieldCacheImpl$FloatCache.createValue(FieldCach > eImpl.java:514) >=20 > at > = org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:22 > 4) >=20 > at > = org.apache.lucene.search.FieldCacheImpl.getFloats(FieldCacheImpl.java:48 > 7) >=20 > at > = org.apache.lucene.search.FieldCacheImpl$FloatCache.createValue(FieldCach > eImpl.java:504) >=20 > at > = org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:22 > 4) >=20 > at > = org.apache.lucene.search.FieldCacheImpl.getFloats(FieldCacheImpl.java:48 > 7) >=20 > at > = org.apache.lucene.search.FieldComparator$FloatComparator.setNextReader(F > ieldComparator.java:269) >=20 > at > = org.apache.lucene.search.TopFieldCollector$MultiComparatorNonScoringColl > ector.setNextReader(TopFieldCollector.java:435) >=20 > at > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:257) >=20 > at > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:240) >=20 > at > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:181) >=20 > at > org.apache.lucene.search.Searcher.search(Searcher.java:90) >=20 >=20 >=20 > The Sort field as seen by the debugger: >=20 > * sort_fields =3D {org.apache.lucene.search.SortField[1]@9010} > * [0] =3D {org.apache.lucene.search.SortField@9011}"!" > * field =3D {java.lang.String@8642}"minprice" > * type =3D 5 > * locale =3D null > * reverse =3D true > * factory =3D null > * parser =3D null > * comparatorSource =3D null > * useLegacy =3D false >=20 > I run out of ideas what might go wrong. I did look at the index with = luke and I > do not see anything special. >=20 > As this happens with the same code on other servers, too, It looks = like some > kind of programming error. >=20 > Any hints? >=20 > Thx >=20 >=20 >=20 > Uwe >=20 >=20 --------------------------------------------------------------------- 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