1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-14 04:51:53 +02:00

Merge remote branch 'origin/master' into dynamic

This commit is contained in:
Leo Franchi 2011-02-06 15:34:53 -05:00
commit 2f8996258f
4 changed files with 34 additions and 28 deletions

View File

@ -19,7 +19,7 @@ FuzzyIndex::FuzzyIndex( DatabaseImpl& db )
bool create = !lucene::index::IndexReader::indexExists( lucenePath.toStdString().c_str() );
m_luceneDir = lucene::store::FSDirectory::getDirectory( lucenePath.toStdString().c_str(), create );
m_analyzer = new lucene::analysis::SimpleAnalyzer();
m_analyzer = _CLNEW lucene::analysis::SimpleAnalyzer();
}
@ -68,13 +68,13 @@ FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QStrin
QString name = it.value();
{
lucene::document::Field* field = new lucene::document::Field( table.toStdWString().c_str(), name.toStdWString().c_str(),
lucene::document::Field* field = _CLNEW lucene::document::Field( table.toStdWString().c_str(), name.toStdWString().c_str(),
lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_UNTOKENIZED );
doc.add( *field );
}
{
lucene::document::Field* field = new lucene::document::Field( _T( "id" ), QString::number( id ).toStdWString().c_str(),
lucene::document::Field* field = _CLNEW lucene::document::Field( _T( "id" ), QString::number( id ).toStdWString().c_str(),
lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO );
doc.add( *field );
}
@ -109,7 +109,7 @@ FuzzyIndex::search( const QString& table, const QString& name )
}
m_luceneReader = lucene::index::IndexReader::open( m_luceneDir );
m_luceneSearcher = new lucene::search::IndexSearcher( m_luceneReader );
m_luceneSearcher = _CLNEW lucene::search::IndexSearcher( m_luceneReader );
}
if ( name.isEmpty() )
@ -119,8 +119,7 @@ FuzzyIndex::search( const QString& table, const QString& name )
lucene::queryParser::QueryParser parser( table.toStdWString().c_str(), m_analyzer );
lucene::search::Hits* hits = 0;
lucene::search::FuzzyQuery* qry = new lucene::search::FuzzyQuery( new lucene::index::Term( table.toStdWString().c_str(),
name.toStdWString().c_str() ) );
lucene::search::FuzzyQuery* qry = _CLNEW lucene::search::FuzzyQuery( _CLNEW lucene::index::Term( table.toStdWString().c_str(), name.toStdWString().c_str() ) );
hits = m_luceneSearcher->search( qry );
for ( unsigned int i = 0; i < hits->length(); i++ )

View File

@ -85,16 +85,16 @@ Pipeline::resolve( const QList<query_ptr>& qlist, bool prioritized )
m_qids.insert( q->id(), q );
}
}
}
if ( prioritized )
{
for( int i = qlist.count() - 1; i >= 0; i-- )
m_queries_pending.insert( 0, qlist.at( i ) );
}
else
{
m_queries_pending.append( qlist );
if ( prioritized )
{
for( int i = qlist.count() - 1; i >= 0; i-- )
m_queries_pending.insert( 0, qlist.at( i ) );
}
else
{
m_queries_pending.append( qlist );
}
}
if ( m_index_ready && m_queries_pending.count() )
@ -162,19 +162,25 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
void
Pipeline::shuntNext()
{
if ( m_queries_pending.isEmpty() )
query_ptr q;
{
emit idle();
return;
QMutexLocker lock( &m_mut );
if ( m_queries_pending.isEmpty() )
{
emit idle();
return;
}
/*
Since resolvers are async, we now dispatch to the highest weighted ones
and after timeout, dispatch to next highest etc, aborting when solved
*/
q = m_queries_pending.takeFirst();
q->setLastPipelineWeight( 101 );
}
/*
Since resolvers are async, we now dispatch to the highest weighted ones
and after timeout, dispatch to next highest etc, aborting when solved
*/
query_ptr q = m_queries_pending.takeFirst();
q->setLastPipelineWeight( 101 );
shunt( q ); // bump into next stage of pipeline (highest weights are 100)
}

View File

@ -8,7 +8,8 @@ using namespace Tomahawk;
Result::Result() {}
Result::Result( const QVariant& v, const collection_ptr& collection )
: m_v( v )
: QObject()
, m_v( v )
, m_collection( collection )
{
QVariantMap m = m_v.toMap();

View File

@ -27,7 +27,7 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
m_tracksModel = new PlaylistModel( ui->tracksView );
ui->tracksView->setModel( m_tracksModel );
m_tracksModel->loadHistory( Tomahawk::source_ptr() );
m_tracksModel->loadHistory( Tomahawk::source_ptr(), 50 );
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );