Hi Stefano.

I answered someone's question on stackoverflow which is basically the same
question you have:
http://stackoverflow.com/questions/13723891/lucene-4-0-spatial-calculate-max-distance-dynamically-using-indexed-documets/13764793#13764793

Essentially, you should index circles and then search by your query point. 
That technique requires Solr 4.  I recommend the very latest 4.1 about to be
released for indexing non-point shapes as there are some rare bugs in 4.0.

I think you could also do it with Solr 3 spatial with something like:
{!frange l=0 u=99999}sub(distField,geodist(sfield,lat,lon)).  However this
is internally a brute-force algorithm vs. Solr 4 indexing shapes which uses
an index (fast!).

~ David


stefanocorsi wrote
> Hello,
> 
> I have an index containing items with a range of distance in which I would
> like these items to be found when searched. Furthermore, in the same
> index, I have the position of the item. For example.
> 
> Item A - 46.23211131, 10.3213213131 - 30km
> Item B - 45.23211131, 9.3213213131 - 50km
> ...
> Item N - 46.32132132, 10.213211321 - 100Km
> 
> I would like to be able to make the following query:
> 
> given a certain point X (let's say 46.323231223, 10.32132132131) I would
> like to find all the items that are in the range of that point, according
> to the item's range: i.e. if an item has a 30Km range, it should find
> itself in 30Km range from point X, if an item has a 100Km range, it should
> find itself in a 100Km range from point X, and so on...
> 
> I hope I have explained it in a decent way...
> 
> Is there a way to do it? With solr 3? With solr 4?
> 
> Thank you for your help...
> 
> Stefano





-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Distance-Range-query-tp4034977p4035083.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to