diff options
| author | Eliot Horowitz <eliot@10gen.com> | 2010-03-25 10:17:51 -0400 |
|---|---|---|
| committer | Eliot Horowitz <eliot@10gen.com> | 2010-03-25 10:34:55 -0400 |
| commit | 35885ba8de830d09d8b29d3385154159dee70ccc (patch) | |
| tree | dc49e679f5535264942fd6574974b09258993858 | |
| parent | 656cd5df27a705c714ac0052a54e5cd0e2bfeb56 (diff) | |
fix looping with circle queries for geo
| -rw-r--r-- | db/index_geo2d.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/db/index_geo2d.cpp b/db/index_geo2d.cpp index 2006fcea50b..4730c29cbfd 100644 --- a/db/index_geo2d.cpp +++ b/db/index_geo2d.cpp @@ -1201,11 +1201,13 @@ namespace mongo { if ( ! _cur.isEmpty() || _stack.size() ) return true; - if ( ! moreToDo() ) - return false; + while ( moreToDo() ){ + fillStack(); + if ( ! _cur.isEmpty() ) + return true; + } - fillStack(); - return ! _cur.isEmpty(); + return false; } virtual bool advance(){ @@ -1296,12 +1298,13 @@ namespace mongo { while ( _max.hasPrefix( _prefix ) && _max.advance( 1 , _found , this ) ); if ( ! _prefix.constrains() ){ - // we've exhausted the btree + GEODEBUG( "\t exhausted the btree" ); _state = DONE; return; } if ( _g->distance( _prefix , _start ) > _maxDistance ){ + GEODEBUG( "\tpast circle bounds" ); GeoHash tr = _prefix; tr.move( 1 , 1 ); if ( _g->distance( tr , _start ) > _maxDistance ) @@ -1322,6 +1325,7 @@ namespace mongo { virtual bool checkDistance( const GeoHash& h , double& d ){ d = _g->distance( _start , h ); + GEODEBUG( "\t " << h << "\t" << d ); return d <= ( _maxDistance + .01 ); } |
