# lucene-solr-user mailing list archives

##### Site index · List index
Message view
Top
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Questions about hsin and dist
Date Mon, 14 Jun 2010 19:35:34 GMT
```
i'm not very knowledgable on spatial search, but...

: for example, if I were to use a filter query such as
:
: {!frange l=0 u=75}dist(2,latitude,longitude,44.0,73.0)
:
: I would expect it to return all results within 75 mi of the given
: latitude and longitude. however, the values being returned are far
: outside of that range:

nothing in the wiki for the dist function suggests that the returned value
is in miles -- it's notably devoid of mention of units of measurements.  I
believe (but am not certain) based on skimming the Junit
test that it's returning a number between 0 and 1 (as noted in the docs,
it's finding the distance between two *vectors*)

: {!frange}hsin(1,44.0,73.0,latitude,longitude,true)
:
: expecting that it would return a filtered set of queries in a radius
: of 1 mi within 44.0lat and 73.0 long, where true tells the hsin
: function to convert to radians. However, whether or not the filter is

That doens't match my reading of the docs at all -- as i understand it,
the "radius" argument to the hsin function is the radius of the sphere, in
whatever units you want, and then it computes the distance between two
points on that sphere using the same units.  so if you want to filter to
only points within 1 mile of some specific point (where all points are
specified in degrees) you would use something like...

fq={!frange l=0 u=1}hsin(XXX,44.0,73.0,latitude,longitude,true)

...where XXX is the radius of hte earth in miles (i didn't bother to look
it up)

-Hoss

```
Mime
View raw message