Changeset 561 for trunk/tools/assistant/lib/qhelpsearchengine.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/tools/assistant/lib/qhelpsearchengine.cpp
r2 r561 2 2 ** 3 3 ** 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]) 5 6 ** 6 7 ** This file is part of the Qt Assistant of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 #include "qhelpsearchresultwidget.h" 46 46 47 47 48 #if defined(QT_CLUCENE_SUPPORT) 48 49 # include "qhelpsearchindexreader_clucene_p.h" … … 85 86 , helpEngine(helpEngine) 86 87 { 87 hitList.clear();88 88 indexReader = 0; 89 89 indexWriter = 0; … … 92 92 ~QHelpSearchEnginePrivate() 93 93 { 94 hitList.clear();95 94 delete indexReader; 96 95 delete indexWriter; 97 96 } 98 97 99 int hit sCount() const98 int hitCount() const 100 99 { 101 100 int count = 0; 102 101 if (indexReader) 103 count = indexReader->hit sCount();102 count = indexReader->hitCount(); 104 103 105 104 return count; … … 108 107 QList<QHelpSearchEngine::SearchHit> hits(int start, int end) const 109 108 { 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>(); 116 112 } 117 113 … … 132 128 } 133 129 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); 139 133 } 140 134 … … 154 148 155 149 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 158 155 connect(indexReader, SIGNAL(searchingStarted()), this, SIGNAL(searchingStarted())); 159 156 connect(indexReader, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int))); 160 157 } 161 158 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); 167 162 } 168 163 … … 190 185 #if defined(QT_CLUCENE_SUPPORT) 191 186 if (indexWriter && !helpEngine.isNull()) { 192 indexWriter->optimizeIndex(); 187 indexWriter->optimizeIndex(); 193 188 } 194 189 #endif … … 201 196 QHelpSearchResultWidget *resultWidget; 202 197 203 QHelpSearchIndexReader *indexReader;198 QHelpSearchIndexReader *indexReader; 204 199 QHelpSearchIndexWriter *indexWriter; 205 200 206 201 QPointer<QHelpEngineCore> helpEngine; 207 QList<QHelpSearchEngine::SearchHit> hitList;208 202 209 203 QList<QHelpSearchQuery> m_queryList; … … 244 238 245 239 \value DEFAULT the default field provided by the search widget, several terms should be 246 split ted and stored in the wordlist except search terms enclosed in quotes.240 splitlist except search terms enclosed in quotes. 247 241 \value FUZZY a field only provided in use with clucene. Terms should be split in seperate 248 242 words and passed to the search engine. … … 331 325 { 332 326 d = new QHelpSearchEnginePrivate(helpEngine); 333 327 334 328 connect(helpEngine, SIGNAL(setupFinished()), this, SLOT(indexDocumentation())); 335 329 … … 372 366 373 367 /*! 368 374 369 Returns the amount of hits the search engine found. 370 375 371 */ 376 372 int QHelpSearchEngine::hitsCount() const 377 373 { 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 */ 381 int QHelpSearchEngine::hitCount() const 382 { 383 return d->hitCount(); 379 384 } 380 385
Note:
See TracChangeset
for help on using the changeset viewer.