コード例 #1
0
ファイル: index_tag.cpp プロジェクト: 3rf/mongo
 void tagForSort(MatchExpression* tree) {
     if (!Indexability::nodeCanUseIndexOnOwnField(tree)) {
         size_t myTagValue = IndexTag::kNoIndex;
         for (size_t i = 0; i < tree->numChildren(); ++i) {
             MatchExpression* child = tree->getChild(i);
             tagForSort(child);
             IndexTag* childTag = static_cast<IndexTag*>(child->getTag());
             if (NULL != childTag) {
                 myTagValue = std::min(myTagValue, childTag->index);
             }
         }
         if (myTagValue != IndexTag::kNoIndex) {
             tree->setTag(new IndexTag(myTagValue));
         }
     }
 }
コード例 #2
0
ファイル: plan_enumerator.cpp プロジェクト: ChrisKozak/mongo
    bool PlanEnumerator::getNext(MatchExpression** tree) {
        if (_done) { return false; }

        // Tag with our first solution.
        tagMemo(_nodeToId[_root]);

        *tree = _root->shallowClone();
        tagForSort(*tree);
        sortUsingTags(*tree);

        _root->resetTag();
        QLOG() << "Enumerator: memo right before moving:\n";
        dumpMemo();
        _done = nextMemo(_nodeToId[_root]);
        QLOG() << "Enumerator: memo right after moving:\n";
        dumpMemo();
        return true;
    }