So, I’m working on a search engine of sorts that restricts results to
your local area. I can successfully return all entries within 15 miles
of a particular point, and I can successfully return all entries that
match a search query, but I’m having trouble combining the two together
and doing pagination on them.
Basically, for the range query, you do a SQL query that returns all
results within +/- 1 latitude/longitude from the point in question, and
then you do some spherical trig on each of those results to get only the
entries within X number of miles of the point.
And for the search query, so far, I’ve been using acts_as_ferret’s
find_by_contents method. But now I need to figure out how to take an
array of results from the range query, and only do the find_by_contents
magic on just the entries in that Array. So far, everything method I’ve
thought of looks like it’s going to have performance problems.