我想能够列出1000个结果,但我被限制在20,因为ASC的限制与宝石思维狮身人面像。
如何提高ASC限制0,20到0,1000?

SELECT GEODIST(0.5904448859496816, -1.464156709498043, latitude, longitude) AS geodist, *
FROM `location_core`
WHERE `geodist` BETWEEN 0.0 AND 200000.0 AND `sphinx_deleted` = 0
ORDER BY `geodist` ASC
LIMIT 0, 20

这是我必须用MYSQL修改的吗?
控制器:
  def index
       location  = Location.find_by_zipcode params[:zipcode]
        latitude  = location.latitude * Math::PI / 180
        longitude = location.longitude * Math::PI / 180

        location_ids = Location.search_for_ids(
          :geo   => [latitude, longitude],
          :with  => {:geodist => 0.0..200_000.0}
        )
        @users = User.where(:location_id => location_ids)
      end

最佳答案

ASC 0,20可以。
改变

 :geo   => [latitude, longitude],
          :with  => {:geodist => 0.0..200_000.0}


  :geo   => [latitude, longitude],
  :with  => {:geodist => 0.0..200_000.0},
  :per_page => 1_000

10-02 05:25