Try using "geo_distance" in the return fields.
On Thu, Apr 29, 2010 at 9:26 AM, Jean-Sebastien Vachon <js.vac...@videotron.ca> wrote: > Hi All, > > I am using JTeam's Spatial Plugin RC3 to perform spatial searches on my index > and it works great. However, I can't seem to get it to return the computed > distances. > > My query component is run before the geoDistanceComponent and the > distanceField is set to "distance" > Fields for lat/long are defined as well and the different tiers field are in > the results. Increasing the radius cause the number of matches to increase so > I guess that my setup is working... > > Here is sample query and its output (I removed some of the fields to keep it > short): > > /select?passkey=sample&q={!spatial%20lat=40.27%20long=-76.29%20radius=22%20calc=arc}title:engineer&wt=json&indent=on&fl=*,distance > > -------- > > { > "responseHeader":{ > "status":0, > "QTime":69, > "params":{ > "fl":"*,distance", > "indent":"on", > "q":"{!spatial lat=40.27 long=-76.29 radius=22 > calc=arc}title:engineer", > "wt":"json"}}, > "response":{"numFound":223,"start":0,"docs":[ > { > > "title":"Electrical Engineer", > "long":-76.3054962158203, > "lat":40.037899017334, > "_tier_9":-3.004, > "_tier_10":-6.0008, > "_tier_11":-12.0016, > "_tier_12":-24.0031, > "_tier_13":-47.0061, > "_tier_14":-93.00122, > "_tier_15":-186.00243, > "_tier_16":-372.00485}, > }} > > This output suggests to me that everything is in place. Anyone knows how to > fetch the computed distance? I tried adding the field 'distance' to my list > of fields but it didn't work > > Thanks >