Reputation: 2914
I would like to be able to list 1000 results, however I am being limited to 20 due to the ASC Limit with the gem thinking sphinx.
How can I increase the ASC Limit 0, 20 to 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
Is this something I have to modify with MYSQL?
controller:
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
Upvotes: 1
Views: 78
Reputation: 1395
The ASC 0,20 is fine.
Change
:geo => [latitude, longitude],
:with => {:geodist => 0.0..200_000.0}
to
:geo => [latitude, longitude],
:with => {:geodist => 0.0..200_000.0},
:per_page => 1_000
Upvotes: 1