lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Problems with RangeQueries
Date Mon, 09 May 2011 10:21:24 GMT
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: uwe@thetaphi.de


> -----Original Message-----
> From: Kolhoff, Jacqueline - ENCOWAY [mailto:Kolhoff@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message