mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 17:43:59 +02:00
* Catch CLuceneError exceptions.
This commit is contained in:
@@ -45,8 +45,17 @@ void
|
||||
FuzzyIndex::beginIndexing()
|
||||
{
|
||||
m_mutex.lock();
|
||||
|
||||
try
|
||||
{
|
||||
IndexWriter luceneWriter = IndexWriter( m_luceneDir, m_analyzer, true );
|
||||
}
|
||||
catch( CLuceneError& error )
|
||||
{
|
||||
qDebug() << "Caught CLucene error:" << error.what();
|
||||
Q_ASSERT( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@@ -59,6 +68,8 @@ FuzzyIndex::endIndexing()
|
||||
|
||||
void
|
||||
FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QString >& fields )
|
||||
{
|
||||
try
|
||||
{
|
||||
delete m_luceneSearcher;
|
||||
delete m_luceneReader;
|
||||
@@ -94,6 +105,12 @@ FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QStrin
|
||||
|
||||
luceneWriter.close();
|
||||
}
|
||||
catch( CLuceneError& error )
|
||||
{
|
||||
qDebug() << "Caught CLucene error:" << error.what();
|
||||
Q_ASSERT( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@@ -109,6 +126,8 @@ FuzzyIndex::search( const QString& table, const QString& name )
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
QMap< int, float > resultsmap;
|
||||
try
|
||||
{
|
||||
if ( !m_luceneReader )
|
||||
{
|
||||
if ( !IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() ) )
|
||||
@@ -150,6 +169,12 @@ FuzzyIndex::search( const QString& table, const QString& name )
|
||||
// qDebug() << "Hitres:" << result << id << score << table << name;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( CLuceneError& error )
|
||||
{
|
||||
qDebug() << "Caught CLucene error:" << error.what();
|
||||
Q_ASSERT( false );
|
||||
}
|
||||
|
||||
return resultsmap;
|
||||
}
|
||||
|
Reference in New Issue
Block a user