mirror of https://github.com/kiwix/libkiwix.git
+ clucene fix for the new indexer
This commit is contained in:
parent
5aacc01d65
commit
6e5d8f717e
|
@ -23,25 +23,23 @@ namespace kiwix {
|
||||||
|
|
||||||
TCHAR buffer[MAX_BUFFER_SIZE];
|
TCHAR buffer[MAX_BUFFER_SIZE];
|
||||||
|
|
||||||
CluceneIndexer::CluceneIndexer(const string &zimFilePath, const string &cluceneDirectoryPath) :
|
CluceneIndexer::CluceneIndexer() {
|
||||||
Indexer(zimFilePath) {
|
|
||||||
|
|
||||||
this->dir = FSDirectory::getDirectory(cluceneDirectoryPath.c_str(), true);
|
|
||||||
this->writer = new IndexWriter(dir, &analyzer, true);
|
|
||||||
writer->setUseCompoundFile(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 &title,
|
||||||
const string &unaccentedTitle,
|
const string &unaccentedTitle,
|
||||||
const string &keywords,
|
const string &keywords,
|
||||||
const string &content,
|
const string &content,
|
||||||
const string &snippet,
|
const string &snippet,
|
||||||
const string &size,
|
const string &size,
|
||||||
const string &wordCount) {
|
const string &wordCount) {
|
||||||
|
|
||||||
Document doc;
|
Document doc;
|
||||||
|
|
||||||
|
@ -75,11 +73,11 @@ namespace kiwix {
|
||||||
this->writer->addDocument(&doc);
|
this->writer->addDocument(&doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CluceneIndexer::indexNextPercentPost() {
|
void CluceneIndexer::flush() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CluceneIndexer::stopIndexing() {
|
void CluceneIndexer::indexingPostlude() {
|
||||||
writer->setUseCompoundFile(true);
|
this->writer->setUseCompoundFile(true);
|
||||||
this->writer->optimize();
|
this->writer->optimize();
|
||||||
this->writer->close();
|
this->writer->close();
|
||||||
delete this->writer;
|
delete this->writer;
|
||||||
|
|
|
@ -40,20 +40,20 @@ namespace kiwix {
|
||||||
class CluceneIndexer : public Indexer {
|
class CluceneIndexer : public Indexer {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CluceneIndexer(const string &zimFilePath, const string &cluceneDirectoryPath);
|
CluceneIndexer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void indexNextPercentPre();
|
void indexingPrelude(const string &indexPath);
|
||||||
void indexNextArticle(const string &url,
|
void index(const string &url,
|
||||||
const string &title,
|
const string &title,
|
||||||
const string &unaccentedTitle,
|
const string &unaccentedTitle,
|
||||||
const string &keywords,
|
const string &keywords,
|
||||||
const string &content,
|
const string &content,
|
||||||
const string &snippet,
|
const string &snippet,
|
||||||
const string &size,
|
const string &size,
|
||||||
const string &wordCount);
|
const string &wordCount);
|
||||||
void indexNextPercentPost();
|
void flush();
|
||||||
void stopIndexing();
|
void indexingPostlude();
|
||||||
|
|
||||||
FSDirectory* dir;
|
FSDirectory* dir;
|
||||||
IndexWriter* writer;
|
IndexWriter* writer;
|
||||||
|
|
Loading…
Reference in New Issue