void GeoAccumulator::add(const GeoIndexEntry& node) { _lookedAt++; // Approximate distance check using key data double keyD = 0; Point keyP(_converter->unhashToPoint(node._key.firstElement())); KeyResult keyOk = approxKeyCheck(keyP, keyD); if (keyOk == BAD) { return; } // Check for match using other key (and potentially doc) criteria // Remember match results for each object map<DiskLoc, bool>::iterator match = _matched.find(node.recordLoc); bool newDoc = match == _matched.end(); //cout << "newDoc: " << newDoc << endl; if(newDoc) { bool fetched = false; if (NULL != _filter) { GeoMatchableDocument md(_accessMethod->getDescriptor()->keyPattern(), node._key, node.recordLoc, &fetched); bool good = _filter->matches(&md); _matchesPerfd++; if (fetched) { _objectsLoaded++; } if (! good) { _matched[ node.recordLoc ] = false; return; } } // Don't double-count. if (!fetched) { _objectsLoaded++; } } else if(!((*match).second)) { return; } // Exact check with particular data fields // Can add multiple points int diff = addSpecific(node, keyP, keyOk == BORDER, keyD, newDoc); if(diff > 0) _found += diff; else _found -= -diff; }
void GeoAccumulator::add(const GeoIndexEntry& node) { _lookedAt++; // Approximate distance check using key data double keyD = 0; Point keyP(_converter->unhashToPoint(node._key.firstElement())); KeyResult keyOk = approxKeyCheck(keyP, keyD); if (keyOk == BAD) { return; } // Check for match using other key (and potentially doc) criteria // Remember match results for each object map<DiskLoc, bool>::iterator match = _matched.find(node.recordLoc); bool newDoc = match == _matched.end(); //cout << "newDoc: " << newDoc << endl; if(newDoc) { if (NULL != _filter) { // XXX: use key information to match...shove in WSM, try loc_and_idx, then fetch obj // and try that. BSONObj obj = node.recordLoc.obj(); bool good = _filter->matchesBSON(obj, NULL); _matchesPerfd++; //if (details.hasLoadedRecord()) //_objectsLoaded++; if (! good) { _matched[ node.recordLoc ] = false; return; } } _matched[ node.recordLoc ] = true; } else if(!((*match).second)) { return; } // Exact check with particular data fields // Can add multiple points int diff = addSpecific(node, keyP, keyOk == BORDER, keyD, newDoc); if(diff > 0) _found += diff; else _found -= -diff; }