1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-08 07:07:05 +02:00

* Use a RAMDirectory if we can't open the regular lucene index file.

This commit is contained in:
Christian Muehlhaeuser
2012-07-12 07:22:20 +02:00
parent a6d1bbb91e
commit 20032a40b2

View File

@@ -49,15 +49,24 @@ FuzzyIndex::FuzzyIndex( QObject* parent, bool wipe )
QByteArray path = m_lucenePath.toUtf8(); QByteArray path = m_lucenePath.toUtf8();
const char* cPath = path.constData(); const char* cPath = path.constData();
bool failed = false;
tDebug() << "Opening Lucene directory:" << path; tDebug() << "Opening Lucene directory:" << path;
try try
{ {
m_luceneDir = FSDirectory::getDirectory( cPath );
m_analyzer = _CLNEW SimpleAnalyzer(); m_analyzer = _CLNEW SimpleAnalyzer();
m_luceneDir = FSDirectory::getDirectory( cPath );
} }
catch ( CLuceneError& error ) catch ( CLuceneError& error )
{ {
tDebug() << "Caught CLucene error:" << error.what(); tDebug() << "Caught CLucene error:" << error.what();
failed = true;
}
if ( failed )
{
tDebug() << "Initializing RAM directory instead.";
m_luceneDir = _CLNEW RAMDirectory();
wipe = true; wipe = true;
} }