Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the Qt Assistant of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6060        namespace clucene {
    6161
    62 QHelpSearchIndexReader::QHelpSearchIndexReader()
    63     : QThread()
    64     , m_cancel(false)
     62QHelpSearchIndexReaderClucene::QHelpSearchIndexReaderClucene()
     63    : QHelpSearchIndexReader()
    6564{
    6665    // nothing todo
    6766}
    6867
    69 QHelpSearchIndexReader::~QHelpSearchIndexReader()
    70 {
    71     mutex.lock();
    72     this->m_cancel = true;
    73     waitCondition.wakeOne();
    74     mutex.unlock();
    75 
    76     wait();
    77 }
    78 
    79 void QHelpSearchIndexReader::cancelSearching()
    80 {
    81     mutex.lock();
    82     this->m_cancel = true;
    83     mutex.unlock();
    84 }
    85 
    86 void QHelpSearchIndexReader::search(const QString &collectionFile, const QString &indexFilesFolder,
    87     const QList<QHelpSearchQuery> &queryList)
    88 {
    89     QMutexLocker lock(&mutex);
    90 
    91     this->hitList.clear();
    92     this->m_cancel = false;
    93     this->m_query = queryList;
    94     this->m_collectionFile = collectionFile;
    95     this->m_indexFilesFolder = indexFilesFolder;
    96 
    97     start(QThread::NormalPriority);
    98 }
    99 
    100 int QHelpSearchIndexReader::hitsCount() const
    101 {
    102     return hitList.count();
    103 }
    104 
    105 QHelpSearchEngine::SearchHit QHelpSearchIndexReader::hit(int index) const
    106 {
    107     return hitList.at(index);
    108 }
    109 
    110 void QHelpSearchIndexReader::run()
     68QHelpSearchIndexReaderClucene::~QHelpSearchIndexReaderClucene()
     69{
     70}
     71
     72
     73void QHelpSearchIndexReaderClucene::run()
    11174{
    11275    mutex.lock();
     
    214177#if !defined(QT_NO_EXCEPTIONS)
    215178        } catch(...) {
     179            mutex.lock();
    216180            hitList.clear();
     181            mutex.unlock();
    217182            emit searchingFinished(0);
    218183        }
     
    221186}
    222187
    223 bool QHelpSearchIndexReader::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
     188bool QHelpSearchIndexReaderClucene::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
    224189    QCLuceneStandardAnalyzer &analyzer)
    225190{
     
    238203}
    239204
    240 bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery,
     205bool QHelpSearchIndexReaderClucene::buildQuery(QCLuceneBooleanQuery &booleanQuery,
    241206    const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
    242207{
     
    338303}
    339304
    340 bool QHelpSearchIndexReader::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
     305bool QHelpSearchIndexReaderClucene::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
    341306    const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
    342307{
     
    361326}
    362327
    363 void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine,
     328void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engine,
    364329    QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList)
    365330{
     
    417382        } while (it != hitMap.constBegin());
    418383        boostedList += hitList.mid(count, hitList.count());
    419 
     384        mutex.lock();
    420385        hitList = boostedList;
     386        mutex.unlock();
    421387    }
    422388}
Note: See TracChangeset for help on using the changeset viewer.