lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: ConstantScoreRangeQuery returns wrong results
Date Thu, 15 Nov 2012 22:07:42 GMT
Hi,

doing String-based constant score range queries is slow and the problem you see are caused
by the fact that a range query between 2 *string* terms find all terms between the 2 endpoints.
As there may be ipv6 addresses with the same string prefix, they are in the range.

So:
1. Use NumericField and use NumericRangeQuery to query ranges on IP-Adresses. Just convert
the ipv4 addresses to 32 bit integers and index them Using NumericField. Unfortunately Lucene
has no 128 bit data type for ipv6...
2. Use separate fields for ipv6 and ipv4

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


> -----Original Message-----
> From: tskumar [mailto:saravan.harith@gmail.com]
> Sent: Thursday, November 15, 2012 7:10 PM
> To: java-user@lucene.apache.org
> Subject: ConstantScoreRangeQuery returns wrong results
> 
> I am using ConstantScoreRangeQuery for seaching all ip addresses of range
> where range is 0.0.0.0 to 255.255.255.255.  This is pretty much searching all
> ipV4 adresses.
> 
> I am converting all my ip addresses to strings and indexing them.  For
> example, 0.0.0.0 becomes 00000000 and 255.255.255.255 becomes ffffffff
> where every 2 chars are one octets.
> 
> When I am searching for ip addresses, I am creating query as follows:
> ConstantScoreRangeQuery(fldIdStr, "00000000", "ffffffff", true, true)
> 
> I am storing both ip V4 as well as ip v6.  This query returning ipv6 as well.
> 
> I am using Lucene (lucene-core-2.4.0.jar) 2.4.0;
> 
> Please let me know how can I get only ipv4 addresses.
> 
> Thanks
> Saravan
> 
> 
> 
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/ConstantScoreRangeQuery-returns-
> wrong-results-tp4020568.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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