0
我很好奇MongoDB用來存儲全文搜索索引的數據結構。我無法在文檔中找到任何關於此的描述。MongoDB如何在內部存儲全文搜索索引?
讀initial commit,現在看來似乎習慣用一個B-tree:
/*
* GO: sets the tree cursors on each term in terms, processes the terms by advancing
* the terms cursors and storing the partial
* results and lastly calculates the top results
* @param results, the priority queue containing the top results
* @param limit, number of results in the priority queue
*/
void FTSSearch::go(Results* results, unsigned limit) {
vector< shared_ptr<BtreeCursor> > cursors;
for (unsigned i = 0; i < _query.getTerms().size(); i++) {
const string& term = _query.getTerms()[i];
BSONObj min = FTSIndexFormat::getIndexKey(MAX_WEIGHT, term, _indexPrefix);
BSONObj max = FTSIndexFormat::getIndexKey(0, term, _indexPrefix);
shared_ptr<BtreeCursor> c(BtreeCursor::make(_ns, _id, min, max, true, -1));
cursors.push_back(c);
}
但fts_search.cpp在當前版本中不存在,我無法找到任何的參考數據結構在current implementation。
它仍然是一棵B樹嗎? (它曾經嗎?)它是一個特里?它有什麼不同嗎?
非常感謝您的幫助! – mmaluff