# lucene-java-user mailing list archives

##### Site index · List index
Message view
Top
From "Johnny R. Ruiz III" <jo...@yahoo.com>
Subject Re: How to do RangeQuery on a Computed Value of a Field?
Date Sun, 21 Oct 2007 22:22:51 GMT
```Hi Eric,

Tnx, I just saw the example in Lucene in Action.  But I am not sure how I can apply it in
my case as it was used to sort the results, but what I need is to get only the records that
are within a limit radius.  And I want the results to be sorted according to score (text match
on title ).

Tnx for pointing me to that direction, I will study it and see how I can use it.

Johnny

----- Original Message ----
From: Erick Erickson <erickerickson@gmail.com>
To: java-user@lucene.apache.org; Johnny R. Ruiz III <jorzi@yahoo.com>
Sent: Monday, October 22, 2007 2:56:46 AM
Subject: Re: How to do RangeQuery on a Computed Value of a Field?

There's also an example of something very similar in Lucene In Action.

Erick

On 10/20/07, Johnny R. Ruiz III <jorzi@yahoo.com> wrote:
>
> Hi All,
>
> I was looking for a way to do a range query on 2 numeric field of my
> index.  The tricky part is, I don't directly use the numeric field
but I
> have to use it on a computation formula to satisfy my criteria.
>
> Hope this helps to explain my scenario:
>
> pointX-->  latitude X input by user.
> pointY-->  longitude Y input by user.
>
> locX  -->  field indexed in lucene
> locY  -->  field indexed in lucene
>
> radius -->  constant value as acceptable distance to be returned in
search
> results (hits)
>
> Conditon to satisfy:
>
> Math.sqrt ( (  locX - pointX ) + ( locY - pointY ) ) <= radius
>
> Is this possible in lucene?  Has anyone did this before?  Thanks in
>
> My Actual Use Case is I want to return all location within a certain
> Radius of 1 mile given PointX and PointY from User.
>
> Regards,
> Johnny Ruiz
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
```
Mime
• Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message