Uttkarsh Jain
Uttkarsh Jain

Reputation: 228

Solr: Query based on distance field

I want to query solr with distant parameter and the query should be in distance range.

we have all the cities index in solr with their lat long and boundaries now i want to run a query from a lat long , i want all the cities which are after 50 KM range and below 100 KM range.

In short, i want all the cities which are between 50 to 100 KM range from a given lat long.

Upvotes: 0

Views: 122

Answers (1)

MatsLindh
MatsLindh

Reputation: 52802

You can use a filter query together with frange and geodist():

&sfield=your_latlon_field&pt=lat,lon&fq={!frange l=50000 u=100000}geodist()

Upvotes: 1

Related Questions