258 } else if (STAGE_TEXT == root->getType()) {
|
259 const TextNode* node = static_cast<const TextNode*>(root);
|
260 IndexDescriptor* desc =
|
261 collection->getIndexCatalog()->findIndexByKeyPattern(txn, node->indexKeyPattern);
|
262 invariant(desc);
|
263 const FTSAccessMethod* fam =
|
264 static_cast<FTSAccessMethod*>(collection->getIndexCatalog()->getIndex(desc));
|
265 invariant(fam);
|
266
|
267 TextStageParams params(fam->getSpec());
|
268 params.index = desc;
|
269 params.spec = fam->getSpec();
|
270 params.indexPrefix = node->indexPrefix;
|
271 // We assume here that node->ftsQuery is an FTSQueryImpl, not an FTSQueryNoop. In practice,
|
272 // this means that it is illegal to use the StageBuilder on a QuerySolution created by
|
273 // planning a query that contains "no-op" expressions. TODO: make StageBuilder::build()
|
274 // fail in this case (this improvement is being tracked by SERVER-21510).
|
275 params.query = static_cast<FTSQueryImpl&>(*node->ftsQuery);
|
276 return new TextStage(txn, params, ws, node->filter.get());
|
277 }
|