Мне интересна структура данных, которую MongoDB использует для хранения индекса полного текстового поиска. Я не мог найти описания этого в документации.Как MongoDB хранит индекс полнотекстового поиска внутри?
Чтение initial commit, похоже, он имел обыкновение использовать B-дерево:
/*
* 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