[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.2/kdebase/runtime/nepomuk/services/strigi
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2009-01-19 14:47:09
Message-ID: 1232376429.611604.21210.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 913582 by trueg:
Backport: delete metadata of children of deleted folders
M +27 -5 indexscheduler.cpp
M +8 -0 indexscheduler.h
--- branches/KDE/4.2/kdebase/runtime/nepomuk/services/strigi/indexscheduler.cpp \
#913581:913582 @@ -245,7 +245,7 @@
}
-// this method should be thread-safe ("should" because of the indexreader and \
-writer) +// this method should be thread-safe ("should" because of the unknown \
situation with indexreader and -writer) bool Nepomuk::IndexScheduler::updateDir( \
const QString& dir, Strigi::StreamAnalyzer* analyzer, bool recursive ) {
// kDebug() << dir << analyzer << recursive;
@@ -262,7 +262,7 @@
QList<QFileInfo> filesToIndex;
QList<QString> subFolders;
- std::vector<std::string> filesToDelete;
+ std::vector<std::string> filesToUpdate, filesToDelete;
// iterate over all files in the dir
// and select the ones we need to add or delete from the store
@@ -284,7 +284,9 @@
if ( indexFile && ( newFile || fileChanged ) )
filesToIndex << fileInfo;
- if ( !newFile && ( fileChanged || !indexFile ) )
+ if ( !newFile && fileChanged )
+ filesToUpdate.push_back( filesInStoreIt->first );
+ else if ( !newFile && !indexFile )
filesToDelete.push_back( filesInStoreIt->first );
// cleanup a bit for faster lookups
@@ -302,9 +304,12 @@
filesToDelete.push_back( it->first );
}
- // remove all files that need updating or have been removed
- m_indexManager->indexWriter()->deleteEntries( filesToDelete );
+ // remove all files non-recursively that need updating
+ m_indexManager->indexWriter()->deleteEntries( filesToUpdate );
+ // remove all files that have been removed recursively
+ deleteEntries( filesToDelete );
+
// analyze all files that are new or need updating
foreach( const QFileInfo& file, filesToIndex ) {
@@ -462,4 +467,21 @@
}
}
+
+void Nepomuk::IndexScheduler::deleteEntries( const std::vector<std::string>& entries \
) +{
+ // recurse into subdirs
+ for ( int i = 0; i < entries.size(); ++i ) {
+ std::map<std::string, time_t> filesInStore;
+ m_indexManager->indexReader()->getChildren( entries[i], filesInStore );
+ std::vector<std::string> filesToDelete;
+ for ( std::map<std::string, time_t>::const_iterator it = \
filesInStore.begin(); + it != filesInStore.end(); ++it ) {
+ filesToDelete.push_back( it->first );
+ }
+ deleteEntries( filesToDelete );
+ }
+ m_indexManager->indexWriter()->deleteEntries( entries );
+}
+
#include "indexscheduler.moc"
--- branches/KDE/4.2/kdebase/runtime/nepomuk/services/strigi/indexscheduler.h \
#913581:913582 @@ -24,6 +24,8 @@
#include <QtCore/QWaitCondition>
#include <QtCore/QSet>
+#include <vector>
+#include <string>
namespace Strigi {
class StreamAnalyzer;
@@ -107,6 +109,12 @@
bool waitForContinue();
bool updateDir( const QString& dir, Strigi::StreamAnalyzer* analyzer, bool \
recursive );
void analyzeFile( const QFileInfo& file, Strigi::StreamAnalyzer* analyzer );
+
+ /**
+ * Deletes all indexed information about entries and all subfolders and \
files + * from the store
+ */
+ void deleteEntries( const std::vector<std::string>& entries );
// emits indexingStarted or indexingStopped based on parameter. Makes sure
// no signal is emitted twice
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic