Hi, Luke cannot search NumericFields correctly, as the official Lucene QueryParser does not produce numeric ranbge queries, as it does not know that the field is numeric. It uses a TermRangeQuery and that may hit random documents.
Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Kolhoff, Jacqueline - ENCOWAY [mailto:kolh...@encoway.de] > Sent: Monday, May 09, 2011 12:30 PM > To: java-user@lucene.apache.org > Subject: AW: Problems with RangeQueries > > Oh sorry, you're right, these are hibernate search classes. But I tried to > search inside the Luke Tool, and didn't find the right data with the given > query (the query is in fact an org.apache.lucene.search.Query, which will be > wrapped to hibernate search queries), so I thought this might be a Lucene > issue. > > Meanwhile, I found out that Luke does not behave like my application. My > application actually gets the right results, so maybe this is more a settings > issue with Luke. Sorry for that and thanks for your answer. > > Regards, Jacqueline. > > -----Ursprüngliche Nachricht----- > Von: Uwe Schindler [mailto:u...@thetaphi.de] > Gesendet: Montag, 9. Mai 2011 12:21 > An: java-user@lucene.apache.org > Betreff: RE: Problems with RangeQueries > > Hallo Jacqueline, > > I have no idea what classes inside Lucene you use, the term "FieldBridge" > relates more to Hibernate Search, right? So maybe you ask this question on > their mailing list. NumericFieldUtils is also not a Lucene class, to create a > numeric query use NumericRangeQuery.newDoubleRange(field, lower, > upper, lowerIncluded, upperIncluded) and combine the results using > BooleanQuery with Occur.SHOULD to get the OR query. > > This works as expected. Maybe your problem lies in the fact that > NumericFieldUtils class is somehow creating a NRQ with wrong data type and > precision step (must be identical to the one used for indexing with > NumericField). > > Uwe > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > > > -----Original Message----- > > From: Kolhoff, Jacqueline - ENCOWAY [mailto:kolh...@encoway.de] > > Sent: Monday, May 09, 2011 11:10 AM > > To: java-user@lucene.apache.org > > Subject: Problems with RangeQueries > > > > Hi, > > > > I have indexed some numeric properties (double) by adding numeric > > fields like this in a custom FieldBridge: > > NumericField field = new NumericField(propertyName, Store.YES, true); > > field.setDoubleValue(propertyValue); > > document.add(field); > > > > This works fine and with my RangeQueries I get results, except in the > > following case: > > > > I indexed data with the values 4.5, 7.0 and 10.5 for this double > > property > > (name: price). > > > > When I search maybe for all data with price > 4.5 AND price < 10.5 I > > got > the > > correct results, namely data where price=7.0 (The query is > > "+price:{4.5 TO > *} > > +price:{* TO 10.5}") > > > > But when I try to search for the opposite, i.e. price <= 4.5 OR price > > >= > 10.5 I > > get all data with price=4.5 and price=10.5 but also data with > > price=7.0 > which I > > do not expect. The query is: "price:[* TO 4.5] price:[10.5 TO *]" > > > > Did I make something wrong? > > > > Can you help me? > > > > Regards, Jacqueline. > > > > > > P.S.: The query is built with the NumericFieldUtils like this > > NumericFieldUtils.createNumericRangeQuery("price", 4.5, null, false, > false); > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org