> 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.

Hadn't actually thought of having ferret index the lat/long points. 
However, I'm pretty sure I don't want to go down that route.

However, while I was waiting for an answer, I think I figured out how to 
do this query in the fastest way possible.  In this case, it would be 
optimized specifically for my app, and for this one query, but that's 
fine by me because the app only has one thing you ever search against.

The way things are set up, you have a single location in the DB for each 
subscriber.  Each location can have multiple entries.  The geoquery is 
actually done against the locations, not the entries.  So there's a LOT 
fewer of them.  You might have 10-15 locations in a city, max, but each 
location could have hundreds of entries.  So you do the geoquery only 
against the locations, and you get an array of ids for locations within 
range of the point back.  Now you just change the indexed entries to 
also include the ids of the locations they're associated with.  When you 
do the search, you include the list of ids that it can match against as 
part of the query.

That should be possible, correct?

I haven't sat down and worked out exactly what the ferret query syntax 
would look like for that though.

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to