summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_geo.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-08-01 11:01:23 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-08-05 10:46:23 -0400
commitbd0cdbf21d2e91a4b63db6d092378a86f058c73d (patch)
tree0c4797e8dffcbb1aa3db47b52e995b0f21a58ebc /src/mongo/db/matcher/expression_geo.cpp
parent00eeec1ab83c8f4921d1bc1352221168a3a01900 (diff)
downloadmongo-bd0cdbf21d2e91a4b63db6d092378a86f058c73d.tar.gz
SERVER-10376 SERVER-10026 end-to-end part 1: run non-indexed queries
Diffstat (limited to 'src/mongo/db/matcher/expression_geo.cpp')
-rw-r--r--src/mongo/db/matcher/expression_geo.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_geo.cpp b/src/mongo/db/matcher/expression_geo.cpp
index 1cb3239cc87..d6011cd9b8f 100644
--- a/src/mongo/db/matcher/expression_geo.cpp
+++ b/src/mongo/db/matcher/expression_geo.cpp
@@ -21,6 +21,10 @@
namespace mongo {
+ //
+ // Geo queries we don't need an index to answer: geoWithin and geoIntersects
+ //
+
Status GeoMatchExpression::init( const StringData& path, const GeoQuery& query ) {
_query = query;
return initPath( path );
@@ -62,4 +66,44 @@ namespace mongo {
return next;
}
+ //
+ // Parse-only geo expressions: geoNear (formerly known as near).
+ //
+
+ Status GeoNearMatchExpression::init( const StringData& path, const NearQuery& query ) {
+ _query = query;
+ return initPath( path );
+ }
+
+ bool GeoNearMatchExpression::matchesSingleElement( const BSONElement& e ) const {
+ // This shouldn't be called.
+ verify(0);
+ return false;
+ }
+
+ void GeoNearMatchExpression::debugString( StringBuilder& debug, int level ) const {
+ _debugAddSpace( debug, level );
+ debug << "GEONEAR\n";
+ }
+
+ bool GeoNearMatchExpression::equivalent( const MatchExpression* other ) const {
+ if ( matchType() != other->matchType() )
+ return false;
+
+ const GeoNearMatchExpression* realOther = static_cast<const GeoNearMatchExpression*>(other);
+
+ if ( path() != realOther->path() )
+ return false;
+
+ // TODO:
+ // return _query == realOther->_query;
+ return false;
+ }
+
+ LeafMatchExpression* GeoNearMatchExpression::shallowClone() const {
+ GeoNearMatchExpression* next = new GeoNearMatchExpression();
+ next->init( path(), _query );
+ return next;
+ }
+
}