scalableinternetservicesarchive / MapKeep

A location-based note taking application.
1 stars 4 forks source link

Add support for spatial indexing through mysql2 #39

Closed DxTania closed 9 years ago

DxTania commented 9 years ago

This recreates the notes table to include a geometric object (point) and a spatial index on it in mysql (a request for all points near a center went from 0.3 seconds over 1 million points to just 20 milliseconds). In order to support spatial indexing, it was necessary to use the MyISAM engine over InnoDB. Because MyISAM doesn't support foreign keys, I added a trigger (in the migration) that will check if a user exists before inserting into notes. I used the method found here: https://dev.mysql.com/tech-resources/articles/mysql-enforcing-foreign-keys.html

I also deleted fixtures and fixed some tests that were still using fixtures.

Please read https://github.com/rgeo/rgeo for dependencies, or else this won't work on your machine. I had geos through homebrew and had to pass a parameter with its location in order for it to work.

Spatial indexing is there to be used but I haven't yet gotten to using it in the app yet. Will be working on that.

Please make sure to install and run a mysql server

DxTania commented 9 years ago

I'll have to figure out what's wrong on travis ci, but tests pass on my computer.