I have an ipStartNum and ipEndNum indexed (a numeric representation of and IP range with the start and end in separate fields).
Here is a small sample of what this looks like: ipStartNum ipEndNum ipStart ipEnd -------------- ------------- -------------- ----------------- 67108864 83886079 4.0.0.0 4.255.255.255 67276832 67276847 4.2.144.32 4.2.144.47 67277024 67277031 4.2.144.224 4.2.144.231 67277040 67277047 4.2.144.240 4.2.144.247 67277048 67277055 4.2.144.248 4.2.144.255 67277216 67277247 4.2.145.160 4.2.145.191 67277408 67277439 4.2.146.96 4.2.146.127 67277440 67277567 4.2.146.128 4.2.146.255 I can successfully use the Boolean & RangeQuery to supply a start and end num (ex. 67108864 [4.0.0.0] & 83886079 [4.255.255.255] - would return all the above). I now want to be able to provide a single IP within one of these ranges and return the range. Example: IP 4.2.146.200 = 67277512 (numeric). 4.2.146.200 is between 4.2.146.128 & 4.2.146.255. Vice versa -> 67277512 is between 67277440 & 67277567. So if I am supplied 67277512 - I want to query my Lucene index to return the fields indexed by (67277440 - 67277567). How would I go about doing this? In SQL I could just say, WHERE 67277512 BETWEEN ipStartNum AND ipEndNum . I hope that makes sense, if you need further clarification, please ask. cheers