简体   繁体   English

在带有mongoid的rails中的ruby中对geonear搜索结果进行排序

[英]sort geonear search results in ruby on rails with mongoid

I am using below query to get search results 我正在使用下面的查询来获取搜索结果

Org.where('content.attribs.name'=>'cuisine', 'content.attribs.value'=>cuisine ).geo_near([lon,lat], :max_distance => dist, :spherical => true, num: num_results)

now I want to sort these results by Ratings column in desc order 现在我想按“评级”列按降序对这些结果进行排序

pls can anybody help 请任何人可以帮助

The geoNear command returns a document, and not a cursor, so you can't call sort on that. geoNear命令返回一个文档,而不是一个游标,因此您不能在其上调用sort。 You will have to do this in your application code. 您将必须在应用程序代码中执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM