Ich bin neugierig auf die Datenstruktur, die MongoDB verwendet, um den Volltextsuchindex zu speichern. Ich konnte in der Dokumentation keine Beschreibung finden.Wie speichert MongoDB den Volltextsuchindex intern?
die initial commit Lesen, scheint es, wie es ein B-Baum zu verwenden, verwendet:
/*
* 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);
}
Aber fts_search.cpp existiert nicht in der aktuellen Version, und ich konnte keinen Hinweis auf die finden Datenstruktur in der current implementation.
Ist es immer noch ein B-Baum? (War es jemals?) Ist es ein Trie? Ist es etwas anderes?
Vielen Dank für die Hilfe! – mmaluff