+ clucene fix for the new indexer

This commit is contained in:
kelson42 2012-04-07 19:31:11 +00:00
parent 5aacc01d65
commit 6e5d8f717e
2 changed files with 30 additions and 32 deletions

View File

@ -23,18 +23,16 @@ namespace kiwix {
TCHAR buffer[MAX_BUFFER_SIZE];
CluceneIndexer::CluceneIndexer(const string &zimFilePath, const string &cluceneDirectoryPath) :
Indexer(zimFilePath) {
this->dir = FSDirectory::getDirectory(cluceneDirectoryPath.c_str(), true);
this->writer = new IndexWriter(dir, &analyzer, true);
writer->setUseCompoundFile(false);
CluceneIndexer::CluceneIndexer() {
}
void CluceneIndexer::indexNextPercentPre() {
void CluceneIndexer::indexingPrelude(const string &indexPath) {
this->dir = FSDirectory::getDirectory(indexPath.c_str(), true);
this->writer = new IndexWriter(this->dir, &analyzer, true);
this->writer->setUseCompoundFile(false);
}
void CluceneIndexer::indexNextArticle(const string &url,
void CluceneIndexer::index(const string &url,
const string &title,
const string &unaccentedTitle,
const string &keywords,
@ -75,11 +73,11 @@ namespace kiwix {
this->writer->addDocument(&doc);
}
void CluceneIndexer::indexNextPercentPost() {
void CluceneIndexer::flush() {
}
void CluceneIndexer::stopIndexing() {
writer->setUseCompoundFile(true);
void CluceneIndexer::indexingPostlude() {
this->writer->setUseCompoundFile(true);
this->writer->optimize();
this->writer->close();
delete this->writer;

View File

@ -40,11 +40,11 @@ namespace kiwix {
class CluceneIndexer : public Indexer {
public:
CluceneIndexer(const string &zimFilePath, const string &cluceneDirectoryPath);
CluceneIndexer();
protected:
void indexNextPercentPre();
void indexNextArticle(const string &url,
void indexingPrelude(const string &indexPath);
void index(const string &url,
const string &title,
const string &unaccentedTitle,
const string &keywords,
@ -52,8 +52,8 @@ namespace kiwix {
const string &snippet,
const string &size,
const string &wordCount);
void indexNextPercentPost();
void stopIndexing();
void flush();
void indexingPostlude();
FSDirectory* dir;
IndexWriter* writer;