PlanStage::StageState TextStage::work(WorkingSetID* out) { ++_commonStats.works; if (isEOF()) { return PlanStage::IS_EOF; } // Fill out our result queue. if (!_filledOutResults) { PlanStage::StageState ss = fillOutResults(); if (ss == PlanStage::IS_EOF || ss == PlanStage::FAILURE) { return ss; } verify(ss == PlanStage::NEED_TIME); } // Having cached all our results, return them one at a time. // Fill out a WSM. WorkingSetID id = _ws->allocate(); WorkingSetMember* member = _ws->get(id); member->loc = _results[_curResult].loc; member->obj = member->loc.obj(); member->state = WorkingSetMember::LOC_AND_UNOWNED_OBJ; // TODO: Planner can tell us whether or not to do this depending on whether or not we have a // $textScore projection. member->addComputed(new TextScoreComputedData(_results[_curResult].score)); // Advance to next result. ++_curResult; *out = id; return PlanStage::ADVANCED; }
PlanStage::StageState TextStage::work(WorkingSetID* out) { ++_commonStats.works; if (isEOF()) { return PlanStage::IS_EOF; } // Fill out our result queue. if (!_filledOutResults) { PlanStage::StageState ss = fillOutResults(); if (ss == PlanStage::IS_EOF || ss == PlanStage::FAILURE) { return ss; } verify(ss == PlanStage::NEED_TIME); } // Having cached all our results, return them one at a time. WorkingSetID id = _results[_curResult]; // Advance to next result. ++_curResult; *out = id; // If we're returning something, take it out of our DL -> WSID map so that future // calls to invalidate don't cause us to take action for a DL we're done with. WorkingSetMember* member = _ws->get(*out); if (member->hasLoc()) { _wsidByDiskLoc.erase(member->loc); } return PlanStage::ADVANCED; }