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/qhelpsearchengine.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545#include "qhelpsearchresultwidget.h"
    4646
     47
    4748#if defined(QT_CLUCENE_SUPPORT)
    4849#   include "qhelpsearchindexreader_clucene_p.h"
     
    8586        , helpEngine(helpEngine)
    8687    {
    87         hitList.clear();
    8888        indexReader = 0;
    8989        indexWriter = 0;
     
    9292    ~QHelpSearchEnginePrivate()
    9393    {
    94         hitList.clear();
    9594        delete indexReader;
    9695        delete indexWriter;
    9796    }
    9897
    99     int hitsCount() const
     98    int hitCount() const
    10099    {
    101100        int count = 0;
    102101        if (indexReader)
    103             count = indexReader->hitsCount();
     102            count = indexReader->hitCount();
    104103
    105104        return count;
     
    108107    QList<QHelpSearchEngine::SearchHit> hits(int start, int end) const
    109108    {
    110         QList<QHelpSearchEngine::SearchHit> returnValue;
    111         if (indexReader) {
    112             for (int i = start; i < end && i < hitsCount(); ++i)
    113                 returnValue.append(indexReader->hit(i));
    114         }
    115         return returnValue;
     109        return indexReader ?
     110                indexReader->hits(start, end) :
     111                QList<QHelpSearchEngine::SearchHit>();
    116112    }
    117113
     
    132128        }
    133129
    134         if (indexWriter) {
    135             indexWriter->cancelIndexing();
    136             indexWriter->updateIndex(helpEngine->collectionFile(),
    137                 indexFilesFolder(), reindex);
    138         }
     130        indexWriter->cancelIndexing();
     131        indexWriter->updateIndex(helpEngine->collectionFile(),
     132                                 indexFilesFolder(), reindex);
    139133    }
    140134
     
    154148
    155149        if (!indexReader) {
    156             indexReader = new QHelpSearchIndexReader();
    157 
     150#if defined(QT_CLUCENE_SUPPORT)
     151            indexReader = new QHelpSearchIndexReaderClucene();
     152#else
     153            indexReader = new QHelpSearchIndexReaderDefault();
     154#endif // QT_CLUCENE_SUPPORT
    158155            connect(indexReader, SIGNAL(searchingStarted()), this, SIGNAL(searchingStarted()));
    159156            connect(indexReader, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int)));
    160157        }
    161158
    162         if (indexReader) {
    163             m_queryList = queryList;
    164             indexReader->cancelSearching();
    165             indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList);
    166         }
     159        m_queryList = queryList;
     160        indexReader->cancelSearching();
     161        indexReader->search(helpEngine->collectionFile(), indexFilesFolder(), queryList);
    167162    }
    168163
     
    190185#if defined(QT_CLUCENE_SUPPORT)
    191186        if (indexWriter && !helpEngine.isNull()) {
    192             indexWriter->optimizeIndex();           
     187            indexWriter->optimizeIndex();
    193188        }
    194189#endif
     
    201196    QHelpSearchResultWidget *resultWidget;
    202197
    203     QHelpSearchIndexReader *indexReader;
     198    QHelpSearchIndexReader *indexReader;
    204199    QHelpSearchIndexWriter *indexWriter;
    205200
    206201    QPointer<QHelpEngineCore> helpEngine;
    207     QList<QHelpSearchEngine::SearchHit> hitList;
    208202
    209203    QList<QHelpSearchQuery> m_queryList;
     
    244238
    245239    \value DEFAULT  the default field provided by the search widget, several terms should be
    246                     splitted and stored in the wordlist except search terms enclosed in quotes.
     240                    splitlist except search terms enclosed in quotes.
    247241    \value FUZZY    a field only provided in use with clucene. Terms should be split in seperate
    248242                    words and passed to the search engine.
     
    331325{
    332326    d = new QHelpSearchEnginePrivate(helpEngine);
    333    
     327
    334328    connect(helpEngine, SIGNAL(setupFinished()), this, SLOT(indexDocumentation()));
    335329
     
    372366
    373367/*!
     368
    374369    Returns the amount of hits the search engine found.
     370
    375371*/
    376372int QHelpSearchEngine::hitsCount() const
    377373{
    378     return d->hitsCount();
     374    return d->hitCount();
     375}
     376
     377/*!
     378    \since 4.6
     379    Returns the amount of hits the search engine found.
     380*/
     381int QHelpSearchEngine::hitCount() const
     382{
     383    return d->hitCount();
    379384}
    380385
Note: See TracChangeset for help on using the changeset viewer.