Hi Ravi

To order *within* each group, you can use the order_group_by option:

  :order_group_by => 'geodist ASC'

Does that ensure you're having the right records returned?

-- 
Pat

On 13 Aug 2014, at 6:02 am, [email protected] wrote:

> I have this in the database
> 
> id, npi, location_id, latitude, longitude
> 
> having the npi, lat and long as attributes in the index definition.
> 
> sample records
> 
> 1, 12345, 12, 39.2903848, -76.6121893
> 2, 12345, 13, 49.2133434, -123.9499228
> 3, 12345, 17, 21.8477377, -89.8488202
> 
> {:group_by => :npi , with: {geodist: 0.0..50_000.0}}
> 
> so I get one matching record if any of the three falls within 50 mile radius 
> of my current location.
> When I do this, I alway get the record id 1, no matter what location matches 
> withe distance criteria. this is because group_by npi clause.
> 
> how do get the correct record for the matched record? I am looking for 
> something like having min(geodist), but don't know how. please help.
> 
> Thanks
> Ravi Ada
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to