3636#include " helper_search_index.h"
3737
3838
39- static const int DICT_VERSION = 4 ;
39+ static const int DICT_VERSION = 5 ;
4040
4141namespace QtAs
4242{
@@ -70,8 +70,8 @@ QDataStream& operator>>( QDataStream& s, Document& l )
7070
7171QDataStream& operator <<( QDataStream& s, const Document& l )
7272{
73- s << ( short ) l.docNumber ;
74- s << ( short ) l.frequency ;
73+ s << l.docNumber ;
74+ s << l.frequency ;
7575 return s;
7676}
7777
@@ -347,7 +347,7 @@ void Index::writeDict( QDataStream& stream )
347347 for ( QHash<QString, Entry*>::ConstIterator it = dict.begin (); it != dict.end (); ++it )
348348 {
349349 stream << it.key ();
350- stream << ( int ) it.value ()->documents .count ();
350+ stream << it.value ()->documents .count ();
351351 stream << it.value ()->documents ;
352352 }
353353}
@@ -362,7 +362,7 @@ bool Index::readDict( QDataStream& stream )
362362
363363 stream >> version;
364364
365- if ( version < 2 )
365+ if ( version != DICT_VERSION )
366366 return false ;
367367
368368 stream >> m_charssplit;
@@ -424,9 +424,9 @@ QList< QUrl > Index::query( const QStringList& terms, const QStringList& termSeq
424424
425425 for ( QVector<Document>::ConstIterator doc_it = docs.constBegin (); doc_it != docs.constEnd (); ++doc_it )
426426 {
427- if ( ( * minDoc_it ). docNumber == ( * doc_it ). docNumber )
427+ if ( minDoc_it-> docNumber == doc_it-> docNumber )
428428 {
429- ( * minDoc_it ). frequency += ( * doc_it ). frequency ;
429+ minDoc_it-> frequency += doc_it-> frequency ;
430430 found = true ;
431431 break ;
432432 }
@@ -445,7 +445,7 @@ QList< QUrl > Index::query( const QStringList& terms, const QStringList& termSeq
445445 if ( termSeq.isEmpty () )
446446 {
447447 for ( QVector<Document>::Iterator it = minDocs.begin (); it != minDocs.end (); ++it )
448- results << docList.at ( ( int )( *it ). docNumber );
448+ results << docList.at ( it-> docNumber );
449449
450450 return results;
451451 }
@@ -454,7 +454,7 @@ QList< QUrl > Index::query( const QStringList& terms, const QStringList& termSeq
454454
455455 for ( QVector<Document>::Iterator it = minDocs.begin (); it != minDocs.end (); ++it )
456456 {
457- fileName = docList[( int )( *it ). docNumber ];
457+ fileName = docList[ it-> docNumber ];
458458
459459 if ( searchForPhrases ( termSeq, seqWords, fileName, chmFile ) )
460460 results << fileName;
0 commit comments