summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/planner_ixselect.cpp
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2014-06-05 14:57:34 -0400
committerGreg Studer <greg@10gen.com>2014-06-10 17:06:53 -0400
commit6537dc777512d093a489cb1db99e8db8cf50b914 (patch)
treec1513b2afeb44a500d57a8316e3b65139b56f7f4 /src/mongo/db/query/planner_ixselect.cpp
parente191494d5092181e222c022fe44741951af91a2f (diff)
downloadmongo-6537dc777512d093a489cb1db99e8db8cf50b914.tar.gz
SERVER-5800 convert 2d predicate queries into covered index scans
Diffstat (limited to 'src/mongo/db/query/planner_ixselect.cpp')
-rw-r--r--src/mongo/db/query/planner_ixselect.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mongo/db/query/planner_ixselect.cpp b/src/mongo/db/query/planner_ixselect.cpp
index e8d900851b6..464bffce401 100644
--- a/src/mongo/db/query/planner_ixselect.cpp
+++ b/src/mongo/db/query/planner_ixselect.cpp
@@ -53,14 +53,12 @@ namespace mongo {
* 2d indices don't handle wrapping so we can't use them for queries that wrap.
*/
static bool twoDWontWrap(const Circle& circle, const IndexEntry& index) {
- GeoHashConverter::Parameters params;
- params.bits = static_cast<unsigned>(fieldWithDefault(index.infoObj, "bits", 26));
- params.max = fieldWithDefault(index.infoObj, "max", 180.0);
- params.min = fieldWithDefault(index.infoObj, "min", -180.0);
- double numBuckets = (1024 * 1024 * 1024 * 4.0);
- params.scaling = numBuckets / (params.max - params.min);
-
- GeoHashConverter conv(params);
+
+ GeoHashConverter::Parameters hashParams;
+ Status paramStatus = GeoHashConverter::parseParameters(index.infoObj, &hashParams);
+ verify(paramStatus.isOK()); // we validated the params on index creation
+
+ GeoHashConverter conv(hashParams);
// FYI: old code used flat not spherical error.
double yscandist = rad2deg(circle.radius) + conv.getErrorSphere();