[wp-hackers] Search Results based on Geodata

Michael D Adams mda at blogwaffe.com
Sat Jun 5 21:51:12 UTC 2010


> So the problem I'm getting stuck on is that every point someone might search from is potentially a different index and thus it seems that every search result would need to be generated by a very slow sequential scan of the database.  The best I can come up with is to build ad-hoc records in an table used for indexing that contains a subset of data that is near the geo point by a square grid, "index" those by the distance from my geo point, then cache the results for 24 hours from the last time someone needed them. Has anyone got a better way? (I'm really hoping I'm missing something very obvious here.)

I am against having core add a new table, which is what would be
required to do fast geo lookups of this type.  IIRC, MySQL can do
geoindices natively, though, so I don't think your approach is
necessary.  I don't think MySQL is very fast at it, though.

My suggestion to plugins that want to offer this type query (or to
speed this query up if it ends up going into core) would be to require
sphinx: http://sphinxsearch.com/

Sphinx adds a dependency that not every blog will be able to install,
but it's super fast and has great geo search built in.

I think the common geo use case in most of the WP installs out there
is just: let me assign geodata to a post/image/comment/user and then
let me display that textually/on a map/etc.  You don't need a geoindex
for any of that.


More information about the wp-hackers mailing list