rnelson/ne_state_restaurant_inspections — pull request #2 by natebenes (2013-12-30 20:15:37+00:00)
Title: Remove spatial query

This replaces the spatial query to CartoDB with a simple bounding box query. This also batches firm searches into one HTTP request/response which is much nicer on all parties.

In addition to being nicer to the database, app server, and browser, it speeds up searches from 20+ seconds to 1.5 seconds on my test setup.

**NB**: You probably make this even faster by adding a composite index over `firm.lat` and `firm.lng`. I did this in the model but I don't think you call `auto_upgrade` anywhere so datamapper doesn't pick it up.