On Wed, Jan 31, 2007 at 03:21:31PM +0100, Bob Aman wrote: > 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. wouldn't it be possible to query the ferret index for all points withing the +/- 1 long/lat range? then you could combine the user's search terms with that query, and afterwards do the calculations to filter out those points outside the x miles radius.
> 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. In any case I'd first try what works, and then look at the performance of different approaches with a realistical amount of data. That aside, my first guess is that narrowing down the result set with Ferret before doing any spatial calculations would be a good idea. Jens -- webit! Gesellschaft für neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Krämer [EMAIL PROTECTED] Schnorrstraße 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66 _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

