From 060b37be04726c63d111732b522faa114118b7de Mon Sep 17 00:00:00 2001
From: Ryan Dlugosz <ryan@dlugosz.net>
Date: Sun, 22 Jul 2012 13:48:21 -0400
Subject: [PATCH] Add documentation for within_bounding_box strategy

---
 README.rdoc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/README.rdoc b/README.rdoc
index 5d2739e7..39ac3cff 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -118,6 +118,16 @@ To find objects by location, use the following scopes:
   Venue.geocoded                     # venues with coordinates
   Venue.not_geocoded                 # venues without coordinates
 
+You can also restrict the bounds used in location queries via the <tt>within_bounding_box</tt> scope. This
+can have a dramatic effect on query performance, especially when used in conjunction with indexes on the lat,
+lng columns.
+
+  distance = 20
+  center_point = [40.71, 100.23]
+  box = Geocoder::Calculations.bounding_box(center_point, distance)
+  Venue.near(center_point, distance).within_bounding_box(box, distance) # same results as above, potentially faster
+  Venue.within_bounding_box(box, distance) # even faster query, but no distance ordering
+
 With geocoded objects you can do things like this:
 
   obj.nearbys(30)                      # other objects within 30 miles
-- 
GitLab