Fix ft index open for chunked files #346

This commit is contained in:
Kelson 2016-10-17 13:16:43 +02:00
parent 5ff4abfab2
commit 1c68cf87b9
1 changed files with 3 additions and 4 deletions

View File

@ -40,14 +40,13 @@ namespace kiwix {
{ {
zim::File zimFile = zim::File(directoryPath); zim::File zimFile = zim::File(directoryPath);
zim::Article xapianArticle = zimFile.getArticle('Z', "/fulltextIndex/xapian"); zim::Article xapianArticle = zimFile.getArticle('Z', "/fulltextIndex/xapian");
if ( ! xapianArticle.good()) if (!xapianArticle.good())
throw NoXapianIndexInZim(); throw NoXapianIndexInZim();
zim::offset_type dbOffset = xapianArticle.getOffset(); zim::offset_type dbOffset = xapianArticle.getOffset();
int databasefd = open(directoryPath.c_str(), O_RDONLY); int databasefd = open(directoryPath.c_str(), O_RDONLY);
lseek(databasefd, dbOffset, SEEK_SET); lseek(databasefd, dbOffset, SEEK_SET);
this->readableDatabase = Xapian::Database(databasefd); this->readableDatabase = Xapian::Database(databasefd);
} catch (zim::ZimFileFormatError) } catch (...) {
{
this->readableDatabase = Xapian::Database(directoryPath); this->readableDatabase = Xapian::Database(directoryPath);
} }
} }