summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
authorKevin Albertson <kevin.albertson@10gen.com>2015-06-11 10:30:46 -0400
committerKevin Albertson <kevin.albertson@10gen.com>2015-07-17 12:07:32 -0400
commitc33f68518b06e6b98596a8133d097e75d8431293 (patch)
tree49757af46288b63155e554f5bcc64b026ef494f4 /src/mongo/db/query
parent0db35ed67ac5c22969cc674a43bf741f85cd9bdc (diff)
downloadmongo-c33f68518b06e6b98596a8133d097e75d8431293.tar.gz
SERVER-19097 Add version 3 to 2dsphere index
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/SConscript1
-rw-r--r--src/mongo/db/query/expression_index.cpp12
-rw-r--r--src/mongo/db/query/expression_index.h6
-rw-r--r--src/mongo/db/query/index_bounds_builder.cpp6
4 files changed, 11 insertions, 14 deletions
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript
index d6a11866243..4d5d65bee31 100644
--- a/src/mongo/db/query/SConscript
+++ b/src/mongo/db/query/SConscript
@@ -83,6 +83,7 @@ env.Library(
"$BUILD_DIR/mongo/bson/bson",
"$BUILD_DIR/mongo/db/matcher/expressions_geo",
"$BUILD_DIR/mongo/db/index_names",
+ "$BUILD_DIR/mongo/db/index/expression_params",
"$BUILD_DIR/mongo/db/mongohasher",
"$BUILD_DIR/mongo/db/server_parameters",
],
diff --git a/src/mongo/db/query/expression_index.cpp b/src/mongo/db/query/expression_index.cpp
index 67f06314266..7f86c374a90 100644
--- a/src/mongo/db/query/expression_index.cpp
+++ b/src/mongo/db/query/expression_index.cpp
@@ -92,18 +92,10 @@ void ExpressionMapping::cover2d(const R2Region& region,
}
}
-// TODO: what should we really pass in for indexInfoObj?
void ExpressionMapping::cover2dsphere(const S2Region& region,
- const BSONObj& indexInfoObj,
+ const S2IndexingParams& indexingParams,
OrderedIntervalList* oilOut) {
- int coarsestIndexedLevel;
- BSONElement ce = indexInfoObj["coarsestIndexedLevel"];
- if (ce.isNumber()) {
- coarsestIndexedLevel = ce.numberInt();
- } else {
- coarsestIndexedLevel = S2::kAvgEdge.GetClosestLevel(100 * 1000.0 / kRadiusOfEarthInMeters);
- }
-
+ int coarsestIndexedLevel = indexingParams.coarsestIndexedLevel;
// The min level of our covering is the level whose cells are the closest match to the
// *area* of the region (or the max indexed level, whichever is smaller) The max level
// is 4 sizes larger.
diff --git a/src/mongo/db/query/expression_index.h b/src/mongo/db/query/expression_index.h
index 910433924ff..c65d57c1322 100644
--- a/src/mongo/db/query/expression_index.h
+++ b/src/mongo/db/query/expression_index.h
@@ -30,8 +30,9 @@
#include "third_party/s2/s2region.h"
-#include "mongo/db/jsobj.h"
#include "mongo/db/geo/shapes.h"
+#include "mongo/db/index/s2_indexing_params.h"
+#include "mongo/db/jsobj.h"
#include "mongo/db/query/index_bounds_builder.h" // For OrderedIntervalList
namespace mongo {
@@ -50,9 +51,8 @@ public:
int maxCoveringCells,
OrderedIntervalList* oil);
- // TODO: what should we really pass in for indexInfoObj?
static void cover2dsphere(const S2Region& region,
- const BSONObj& indexInfoObj,
+ const S2IndexingParams& indexParams,
OrderedIntervalList* oilOut);
};
diff --git a/src/mongo/db/query/index_bounds_builder.cpp b/src/mongo/db/query/index_bounds_builder.cpp
index e32c19eec4d..d515dfd3012 100644
--- a/src/mongo/db/query/index_bounds_builder.cpp
+++ b/src/mongo/db/query/index_bounds_builder.cpp
@@ -35,6 +35,8 @@
#include "mongo/base/string_data.h"
#include "mongo/db/geo/geoconstants.h"
+#include "mongo/db/index/expression_params.h"
+#include "mongo/db/index/s2_indexing_params.h"
#include "mongo/db/matcher/expression_geo.h"
#include "mongo/db/query/expression_index.h"
#include "mongo/db/query/expression_index_knobs.h"
@@ -557,7 +559,9 @@ void IndexBoundsBuilder::translate(const MatchExpression* expr,
if (mongoutils::str::equals("2dsphere", elt.valuestrsafe())) {
verify(gme->getGeoExpression().getGeometry().hasS2Region());
const S2Region& region = gme->getGeoExpression().getGeometry().getS2Region();
- ExpressionMapping::cover2dsphere(region, index.infoObj, oilOut);
+ S2IndexingParams indexParams;
+ ExpressionParams::parse2dsphereParams(index.infoObj, &indexParams);
+ ExpressionMapping::cover2dsphere(region, indexParams, oilOut);
*tightnessOut = IndexBoundsBuilder::INEXACT_FETCH;
} else if (mongoutils::str::equals("2d", elt.valuestrsafe())) {
verify(gme->getGeoExpression().getGeometry().hasR2Region());