summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-08-26 16:52:02 -0400
committerMathias Stearn <mathias@10gen.com>2010-09-02 20:12:37 -0400
commitc6a123f3e8483f4afc563275648a9a26e57fa5a1 (patch)
treedf866e9637d3ecd999ac7c576d232d046496264c
parent0b0fbe7ebae5c315e9ce9767940271860d7aab53 (diff)
downloadmongo-c6a123f3e8483f4afc563275648a9a26e57fa5a1.tar.gz
optimization SERVER-1342
-rw-r--r--db/geo/2d.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/db/geo/2d.cpp b/db/geo/2d.cpp
index b4681c4412e..f95c9b87252 100644
--- a/db/geo/2d.cpp
+++ b/db/geo/2d.cpp
@@ -369,6 +369,10 @@ namespace mongo {
between( _min._x , _max._x , x , fudge ) &&
between( _min._y , _max._y , y , fudge );
}
+
+ bool contains(const Box& other, double fudge=0){
+ return inside(other._min, fudge) && inside(other._max, fudge);
+ }
Point _min;
Point _max;
@@ -900,6 +904,7 @@ namespace mongo {
return;
}
+ _alreadyScanned = Box(_spec, _prefix);
_prefix = _prefix.up();
}
}
@@ -949,6 +954,9 @@ namespace mongo {
cout << " doBox: " << testBox.toString() << "\t" << toscan.toString() << " scanned so far: " << _nscanned << endl;
}
+ if (_alreadyScanned.contains(testBox, _spec->_error))
+ return; // been here, done this
+
double intPer = testBox.intersects( want );
if ( intPer <= 0 )
@@ -990,6 +998,8 @@ namespace mongo {
long long _nscanned;
int _found;
GeoDistType _type;
+
+ Box _alreadyScanned;
};
class GeoCursorBase : public Cursor {