mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-13 20:41:58 +02:00
* Fixed win32 build by breaking Linux. Will fix that right now, though.
This commit is contained in:
parent
902326bf2a
commit
8a530c1f15
@ -1 +1 @@
|
||||
61
|
||||
63
|
@ -301,6 +301,8 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
|
||||
File "${MING_DLL_PATH}\libechonest.dll"
|
||||
File "${MING_DLL_PATH}\liblastfm.dll"
|
||||
|
||||
File "${MING_LIB}\libclucene-core.dll"
|
||||
|
||||
File "${QXTWEB_DLL_PATH}\libqxtweb-standalone.dll"
|
||||
SectionEnd
|
||||
|
||||
|
@ -360,7 +360,7 @@ target_link_libraries( tomahawklib
|
||||
ogg
|
||||
FLAC++
|
||||
jdns
|
||||
clucene
|
||||
${CLUCENE_LIBRARY}
|
||||
)
|
||||
|
||||
install( TARGETS tomahawklib DESTINATION lib )
|
||||
|
@ -16,10 +16,10 @@ FuzzyIndex::FuzzyIndex( DatabaseImpl& db )
|
||||
, m_luceneSearcher( 0 )
|
||||
{
|
||||
QString lucenePath = TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" );
|
||||
bool create = !lucene::index::IndexReader::indexExists( lucenePath.toStdString().c_str() );
|
||||
m_luceneDir = lucene::store::FSDirectory::getDirectory( lucenePath.toStdString().c_str(), create );
|
||||
bool create = !IndexReader::indexExists( lucenePath.toStdString().c_str() );
|
||||
m_luceneDir = FSDirectory::getDirectory( lucenePath.toStdString().c_str(), create );
|
||||
|
||||
m_analyzer = _CLNEW lucene::analysis::SimpleAnalyzer();
|
||||
m_analyzer = _CLNEW SimpleAnalyzer();
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ void
|
||||
FuzzyIndex::beginIndexing()
|
||||
{
|
||||
m_mutex.lock();
|
||||
lucene::index::IndexWriter luceneWriter = lucene::index::IndexWriter( m_luceneDir, m_analyzer, true );
|
||||
IndexWriter luceneWriter = IndexWriter( m_luceneDir, m_analyzer, true );
|
||||
}
|
||||
|
||||
|
||||
@ -56,9 +56,9 @@ FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QStrin
|
||||
m_luceneSearcher = 0;
|
||||
m_luceneReader = 0;
|
||||
|
||||
bool create = !lucene::index::IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() );
|
||||
lucene::index::IndexWriter luceneWriter = lucene::index::IndexWriter( m_luceneDir, m_analyzer, create );
|
||||
lucene::document::Document doc;
|
||||
bool create = !IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() );
|
||||
IndexWriter luceneWriter = IndexWriter( m_luceneDir, m_analyzer, create );
|
||||
Document doc;
|
||||
|
||||
QMapIterator< unsigned int, QString > it( fields );
|
||||
while ( it.hasNext() )
|
||||
@ -68,14 +68,14 @@ FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QStrin
|
||||
QString name = it.value();
|
||||
|
||||
{
|
||||
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 );
|
||||
Field* field = _CLNEW Field( table.toStdWString().c_str(), name.toStdWString().c_str(),
|
||||
Field::STORE_YES | Field::INDEX_UNTOKENIZED );
|
||||
doc.add( *field );
|
||||
}
|
||||
|
||||
{
|
||||
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 );
|
||||
Field* field = _CLNEW Field( _T( "id" ), QString::number( id ).toStdWString().c_str(),
|
||||
Field::STORE_YES | Field::INDEX_NO );
|
||||
doc.add( *field );
|
||||
}
|
||||
|
||||
@ -102,29 +102,29 @@ FuzzyIndex::search( const QString& table, const QString& name )
|
||||
QMap< int, float > resultsmap;
|
||||
if ( !m_luceneReader )
|
||||
{
|
||||
if ( !lucene::index::IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() ) )
|
||||
if ( !IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() ) )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "index didn't exist.";
|
||||
return resultsmap;
|
||||
}
|
||||
|
||||
m_luceneReader = lucene::index::IndexReader::open( m_luceneDir );
|
||||
m_luceneSearcher = _CLNEW lucene::search::IndexSearcher( m_luceneReader );
|
||||
m_luceneReader = IndexReader::open( m_luceneDir );
|
||||
m_luceneSearcher = _CLNEW IndexSearcher( m_luceneReader );
|
||||
}
|
||||
|
||||
if ( name.isEmpty() )
|
||||
return resultsmap;
|
||||
|
||||
lucene::analysis::SimpleAnalyzer analyzer;
|
||||
lucene::queryParser::QueryParser parser( table.toStdWString().c_str(), m_analyzer );
|
||||
lucene::search::Hits* hits = 0;
|
||||
SimpleAnalyzer analyzer;
|
||||
QueryParser parser( table.toStdWString().c_str(), m_analyzer );
|
||||
Hits* hits = 0;
|
||||
|
||||
lucene::search::FuzzyQuery* qry = _CLNEW lucene::search::FuzzyQuery( _CLNEW lucene::index::Term( table.toStdWString().c_str(), name.toStdWString().c_str() ) );
|
||||
FuzzyQuery* qry = _CLNEW FuzzyQuery( _CLNEW Term( table.toStdWString().c_str(), name.toStdWString().c_str() ) );
|
||||
hits = m_luceneSearcher->search( qry );
|
||||
|
||||
for ( int i = 0; i < hits->length(); i++ )
|
||||
{
|
||||
lucene::document::Document* d = &hits->doc( i );
|
||||
Document* d = &hits->doc( i );
|
||||
|
||||
float score = hits->score( i );
|
||||
int id = QString::fromWCharArray( d->get( _T( "id" ) ) ).toInt();
|
||||
|
@ -7,26 +7,26 @@
|
||||
#include <QString>
|
||||
#include <QMutex>
|
||||
|
||||
namespace lucene
|
||||
{
|
||||
namespace analysis
|
||||
{
|
||||
//namespace lucene
|
||||
//{
|
||||
// namespace analysis
|
||||
// {
|
||||
class SimpleAnalyzer;
|
||||
}
|
||||
namespace store
|
||||
{
|
||||
// }
|
||||
// namespace store
|
||||
// {
|
||||
class Directory;
|
||||
}
|
||||
namespace index
|
||||
{
|
||||
// }
|
||||
// namespace index
|
||||
// {
|
||||
class IndexReader;
|
||||
class IndexWriter;
|
||||
}
|
||||
namespace search
|
||||
{
|
||||
// }
|
||||
// namespace search
|
||||
// {
|
||||
class IndexSearcher;
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
class DatabaseImpl;
|
||||
|
||||
@ -54,10 +54,10 @@ private:
|
||||
DatabaseImpl& m_db;
|
||||
QMutex m_mutex;
|
||||
|
||||
lucene::analysis::SimpleAnalyzer* m_analyzer;
|
||||
lucene::store::Directory* m_luceneDir;
|
||||
lucene::index::IndexReader* m_luceneReader;
|
||||
lucene::search::IndexSearcher* m_luceneSearcher;
|
||||
SimpleAnalyzer* m_analyzer;
|
||||
Directory* m_luceneDir;
|
||||
IndexReader* m_luceneReader;
|
||||
IndexSearcher* m_luceneSearcher;
|
||||
};
|
||||
|
||||
#endif // FUZZYINDEX_H
|
||||
|
6
thirdparty/jdns/CMakeLists.txt
vendored
6
thirdparty/jdns/CMakeLists.txt
vendored
@ -31,11 +31,7 @@ include_directories(
|
||||
|
||||
qt4_wrap_cpp( JDNS_MOC ${JDNS_HEADERS} )
|
||||
|
||||
if(WIN32)
|
||||
ADD_LIBRARY(jdns SHARED ${JDNS_SOURCES} ${JDNS_MOC})
|
||||
else()
|
||||
ADD_LIBRARY(jdns STATIC ${JDNS_SOURCES} ${JDNS_MOC})
|
||||
endif()
|
||||
ADD_LIBRARY(jdns STATIC ${JDNS_SOURCES} ${JDNS_MOC})
|
||||
|
||||
target_link_libraries(jdns
|
||||
${QT_LIBRARIES}
|
||||
|
Loading…
x
Reference in New Issue
Block a user