- Index *ind;
- ind = IndexManager::openIndex("index-toc-file.bsc");
- // open the index specified by the table-of-content (toc) file "index-toc-file.bsc"
- // IndexManager recognizes the suffix of the toc file (in this case ".bsc") and uses it to
- // infer the actual type of the index to be opened (in this case, the basic index).
- int t1;
- ...
- // now fetch the doc info list for term t1
- DocInfoList *dList = ind->docInfoList(t1);
- dList->startIteration();
- while (dList->hasMore()) {
- DocInfo * entry = dList->nextEntry(); // obtains a pointer to a static instance
- cout << "entry doc id: " << entry->docID() << endl;
- cout << "entry term count: " << entry->termCount() << endl;
- // note that you MUST NOT delete entry!
- }
- delete dList; // you MUST delete dList!
- // TermInfoList can be accessed in exactly the same way
- delete ind; // The IndexManager creates a dynamic instance.
Raw Paste