Hi Mat,
On 10/13/2011 03:58 PM, Matthias Lechner wrote:
>> I have not noticed this problem in my systems but I have quite limited
>> indexed folders to maintain my database as small as possible. If you don't
>> have manual data: tags, ratings, coments, maybe deleting your database could
>> help.
> I tried that once, when I did a complete reset of my akonadi/nepomuk
> installation. It did not change anything, unfortunately. Also, the duration
> of
> the lag seems to be connected with the size of the database, which might
> explain why you do not observe this behaviour. However, reducing the database
> size is not useful for me, since the very reason why I need an indexer is
> that
> my files are so numerous that I cannot find them on my own quickly.
It would be interesting to know if the indexing of all files has
finished. If virtuoso is spiking we could debug the issue by logging
into the db:
isql localhost:1111 dba dba
and then calling:
status();
Then the problematic queries should be shown which should help to debug
the problem.
Another important issue are the versions of everything: kde, strigi,
akonadi.
>> In theory if don't appears then there is not indexed. Consider that
>> strigi service fails indexing some files, for example flac files, so you may
>> experiencing this problem.
> Hm, but this problem also occurs with such general stuff like directories.
> strigi should be able to index directories, and it successfully does for at
> least some. But is there any log file that says "failed to index blabla" ?
I have a patch which introduces exactly that functionality as a hidden
config option. Sadly I cannot test it due to some weird linker problem I
cannot figure out.
But I attached the patch in case you want to give it a try. It applies
in kde-runtime/nepomuk. You need to add "debug mode=true" to
~/.kde/share/config/nepomukstrigirc for it to work. Then failures are
written to ~/.kde/share/apps/nepomuk/file-indexer-error-log
Directories are normally indexed just fine.
Cheers,
Sebastian
>> I developed an alternative search method that might be useful to you. It's
>> not integrated in KDE, Krunner or Dolphin, for desing reasons but it has a
>> good query language, supports UTF-8 and don't supports Akonadi :). Nepoogle
>> is called and you can found here:
>
> Thanks, maybe I'll try that!
>
> Regards,
> Mat
>
> _______________________________________________
> Nepomuk mailing list
> [email protected]
> https://mail.kde.org/mailman/listinfo/nepomuk
>
diff --git a/services/fileindexer/fileindexerconfig.cpp
b/services/fileindexer/fileindexerconfig.cpp
index c2af538..dbbf149 100644
--- a/services/fileindexer/fileindexerconfig.cpp
+++ b/services/fileindexer/fileindexerconfig.cpp
@@ -320,4 +320,9 @@ bool
Nepomuk::FileIndexerConfig::suspendOnPowerSaveDisabled() const
return m_config.group( "General" ).readEntry( "disable suspend on
powersave", false );
}
+bool Nepomuk::FileIndexerConfig::isDebugModeEnabled() const
+{
+ return m_config.group( "General" ).readEntry( "debug mode", false );
+}
+
#include "fileindexerconfig.moc"
diff --git a/services/fileindexer/fileindexerconfig.h
b/services/fileindexer/fileindexerconfig.h
index 7f94722..3870a86 100644
--- a/services/fileindexer/fileindexerconfig.h
+++ b/services/fileindexer/fileindexerconfig.h
@@ -139,6 +139,13 @@ namespace Nepomuk {
*/
bool shouldFileBeIndexed( const QString& fileName ) const;
+ /**
+ * Check if the debug mode is enabled. The debug mode is a hidden
+ * configuration option (without any GUI) that will make the indexer
+ * log errors in a dedicated file.
+ */
+ bool isDebugModeEnabled() const;
+
Q_SIGNALS:
void configChanged();
diff --git a/services/fileindexer/indexer/indexer.cpp
b/services/fileindexer/indexer/indexer.cpp
index 7007364..a7e5436 100644
--- a/services/fileindexer/indexer/indexer.cpp
+++ b/services/fileindexer/indexer/indexer.cpp
@@ -78,6 +78,7 @@ public:
StoppableConfiguration m_analyzerConfig;
StrigiIndexWriter* m_indexWriter;
Strigi::StreamAnalyzer* m_streamAnalyzer;
+ QString m_lastError;
};
@@ -99,17 +100,17 @@ Nepomuk::Indexer::~Indexer()
}
-void Nepomuk::Indexer::indexFile( const KUrl& url, const KUrl resUri, uint
mtime )
+bool Nepomuk::Indexer::indexFile( const KUrl& url, const KUrl resUri, uint
mtime )
{
- indexFile( QFileInfo( url.toLocalFile() ), resUri, mtime );
+ return indexFile( QFileInfo( url.toLocalFile() ), resUri, mtime );
}
-void Nepomuk::Indexer::indexFile( const QFileInfo& info, const KUrl resUri,
uint mtime )
+bool Nepomuk::Indexer::indexFile( const QFileInfo& info, const KUrl resUri,
uint mtime )
{
if( !info.exists() ) {
- kDebug() << info.filePath() << " does not exist";
- return;
+ d->m_lastError = QString::fromLatin1("'%1' does not
exist.").arg(info.filePath());
+ return false;
}
d->m_analyzerConfig.setStop( false );
@@ -140,9 +141,12 @@ void Nepomuk::Indexer::indexFile( const QFileInfo& info,
const KUrl resUri, uint
else {
analysisresult.index(0);
}
+
+ d->m_lastError = d->m_indexWriter->lastError();
+ return d->m_lastError.isEmpty();
}
-void Nepomuk::Indexer::indexStdin(const KUrl resUri, uint mtime)
+bool Nepomuk::Indexer::indexStdin(const KUrl resUri, uint mtime)
{
d->m_analyzerConfig.setStop( false );
d->m_indexWriter->forceUri( resUri );
@@ -153,6 +157,14 @@ void Nepomuk::Indexer::indexStdin(const KUrl resUri, uint
mtime)
*d->m_streamAnalyzer );
Strigi::FileInputStream stream( stdin,
QFile::encodeName(resUri.toLocalFile()).data() );
analysisresult.index( &stream );
+
+ d->m_lastError = d->m_indexWriter->lastError();
+ return d->m_lastError.isEmpty();
+}
+
+QString Nepomuk::Indexer::lastError() const
+{
+ return d->m_lastError;
}
#include "indexer.moc"
diff --git a/services/fileindexer/indexer/indexer.h
b/services/fileindexer/indexer/indexer.h
index 4a604bd..e3c63cc 100644
--- a/services/fileindexer/indexer/indexer.h
+++ b/services/fileindexer/indexer/indexer.h
@@ -53,7 +53,7 @@ namespace Nepomuk {
* Index a single local file or folder (files in a folder will
* not be indexed recursively).
*/
- void indexFile( const KUrl& url, const KUrl resUri, uint mtime = 0 );
+ bool indexFile( const KUrl& url, const KUrl resUri, uint mtime = 0 );
/**
* Index a single local file or folder (files in a folder will
@@ -61,13 +61,15 @@ namespace Nepomuk {
* as the above except that it saves an addditional stat of the
* file.
*/
- void indexFile( const QFileInfo& info, const KUrl resUri, uint mtime=0
);
+ bool indexFile( const QFileInfo& info, const KUrl resUri, uint mtime=0
);
/**
* Index a file whose contents are provided via standard input.
*/
- void indexStdin( const KUrl resUri, uint mtime=0 );
+ bool indexStdin( const KUrl resUri, uint mtime=0 );
+ QString lastError() const;
+
private:
class Private;
Private* const d;
diff --git a/services/fileindexer/indexer/main.cpp
b/services/fileindexer/indexer/main.cpp
index 72d373a..ebf778a 100644
--- a/services/fileindexer/indexer/main.cpp
+++ b/services/fileindexer/indexer/main.cpp
@@ -1,7 +1,7 @@
/*
This file is part of the Nepomuk KDE project.
Copyright (C) 2010-11 Vishesh Handa <[email protected]>
- Copyright (C) 2010 Sebastian Trueg <[email protected]>
+ Copyright (C) 2010-2011 Sebastian Trueg <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -31,6 +31,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
+#include <QtCore/QTextStream>
#include <KDebug>
#include <KUrl>
@@ -45,7 +46,7 @@ int main(int argc, char *argv[])
"1.0",
ki18n("NepomukIndexer indexes the contents of a file
and saves the results in Nepomuk"),
KAboutData::License_LGPL_V2,
- ki18n("(C) 2011, Vishesh Handa"));
+ ki18n("(C) 2011, Vishesh Handa, Sebastian Trueg"));
aboutData.addAuthor(ki18n("Vishesh Handa"), ki18n("Current maintainer"),
"[email protected]");
aboutData.addCredit(ki18n("Sebastian Trüg"), ki18n("Developer"),
"[email protected]");
@@ -69,8 +70,14 @@ int main(int argc, char *argv[])
if( args->count() == 0 ) {
Nepomuk::Indexer indexer;
- indexer.indexStdin( uri, mtime );
- return 0;
+ if( !indexer.indexStdin( uri, mtime ) ) {
+ QTextStream s(stdout);
+ s << indexer.lastError();
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
else if( args->isSet("clear") ) {
Nepomuk::clearIndexedData( args->url(0) );
@@ -79,8 +86,14 @@ int main(int argc, char *argv[])
}
else {
Nepomuk::Indexer indexer;
- indexer.indexFile( args->url(0), uri, mtime );
- kDebug() << "Indexed data for" << args->url(0);
- return 0;
+ if( !indexer.indexFile( args->url(0), uri, mtime ) ) {
+ QTextStream s(stdout);
+ s << indexer.lastError();
+ return 1;
+ }
+ else {
+ kDebug() << "Indexed data for" << args->url(0);
+ return 0;
+ }
}
}
diff --git a/services/fileindexer/indexer/nepomukindexwriter.cpp
b/services/fileindexer/indexer/nepomukindexwriter.cpp
index b13cc25..6f30a80 100644
--- a/services/fileindexer/indexer/nepomukindexwriter.cpp
+++ b/services/fileindexer/indexer/nepomukindexwriter.cpp
@@ -238,6 +238,8 @@ public:
// Some services may need to force a specific resource uri
QUrl resourceUri;
+
+ QString lastError;
};
@@ -528,7 +530,10 @@ void Nepomuk::StrigiIndexWriter::finishAnalysis( const
AnalysisResult* idx )
job->setAutoDelete(false);
job->exec();
if( job->error() ) {
- kDebug() << job->errorString();
+ d->lastError = job->errorString();
+ }
+ else {
+ d->lastError.clear();
}
// cleanup
@@ -564,3 +569,9 @@ void Nepomuk::StrigiIndexWriter::forceUri(const QUrl& uri)
{
d->resourceUri = uri;
}
+
+
+QString Nepomuk::StrigiIndexWriter::lastError() const
+{
+ return d->lastError;
+}
diff --git a/services/fileindexer/indexer/nepomukindexwriter.h
b/services/fileindexer/indexer/nepomukindexwriter.h
index 75cadbb..5a70dce 100644
--- a/services/fileindexer/indexer/nepomukindexwriter.h
+++ b/services/fileindexer/indexer/nepomukindexwriter.h
@@ -26,6 +26,7 @@
class KUrl;
class QUrl;
+class QString;
namespace Nepomuk {
@@ -74,6 +75,11 @@ namespace Nepomuk {
void forceUri( const QUrl & uri );
+ /**
+ * Retrieve the last error that occurred or an empty string if there
was none.
+ */
+ QString lastError() const;
+
private:
class Private;
Private* d;
diff --git a/services/fileindexer/indexscheduler.cpp
b/services/fileindexer/indexscheduler.cpp
index 8d6893e..4fecc2f 100644
--- a/services/fileindexer/indexscheduler.cpp
+++ b/services/fileindexer/indexscheduler.cpp
@@ -38,6 +38,7 @@
#include <KDebug>
#include <KTemporaryFile>
#include <KUrl>
+#include <KStandardDirs>
#include "resource.h"
#include "resourcemanager.h"
@@ -167,6 +168,11 @@ Nepomuk::IndexScheduler::IndexScheduler( QObject* parent )
m_indexingDelay( 0 ),
m_currentIndexerJob( 0 )
{
+ // remove old indexing error log
+ if(FileIndexerConfig::self()->isDebugModeEnabled()) {
+ QFile::remove(KStandardDirs::locateLocal("data",
QLatin1String("nepomuk/file-indexer-error-log")));
+ }
+
m_cleaner = new IndexCleaner(this);
connect( m_cleaner, SIGNAL(finished(KJob*)), this,
SLOT(slotCleaningDone()) );
m_cleaner->start();
diff --git a/services/fileindexer/nepomukindexer.cpp
b/services/fileindexer/nepomukindexer.cpp
index d89a6b8..9588c99 100644
--- a/services/fileindexer/nepomukindexer.cpp
+++ b/services/fileindexer/nepomukindexer.cpp
@@ -21,6 +21,7 @@
#include "nepomukindexer.h"
#include "util.h"
+#include "fileindexerconfig.h"
#include "resource.h"
@@ -30,30 +31,30 @@
#include <KStandardDirs>
#include <QtCore/QFileInfo>
+#include <QtCore/QFile>
+#include <QtCore/QTextStream>
Nepomuk::Indexer::Indexer(const KUrl& localUrl, QObject* parent)
: KJob(parent),
- m_url( localUrl ),
- m_exitCode( -1 )
+ m_url( localUrl )
{
}
Nepomuk::Indexer::Indexer(const QFileInfo& info, QObject* parent)
: KJob(parent),
- m_url( info.absoluteFilePath() ),
- m_exitCode( -1 )
+ m_url( info.absoluteFilePath() )
{
}
void Nepomuk::Indexer::start()
{
const QString exe =
KStandardDirs::findExe(QLatin1String("nepomukindexer"));
- m_process = new KProcess( this );
- m_process->setProgram( exe, QStringList() << m_url.toLocalFile() );
-
kDebug() << "Running" << exe << m_url.toLocalFile();
+ m_process = new KProcess( this );
+ m_process->setProgram( exe, QStringList() << m_url.toLocalFile() );
+ m_process->setOutputChannelMode(KProcess::OnlyStdoutChannel);
connect( m_process, SIGNAL(finished(int)), this,
SLOT(slotIndexedFile(int)) );
m_process->start();
}
@@ -62,8 +63,13 @@ void Nepomuk::Indexer::start()
void Nepomuk::Indexer::slotIndexedFile(int exitCode)
{
kDebug() << "Indexing of " << m_url.toLocalFile() << "finished with exit
code" << exitCode;
- m_exitCode = exitCode;
-
+ if(exitCode == 1 && FileIndexerConfig::self()->isDebugModeEnabled()) {
+ QFile errorLogFile(KStandardDirs::locateLocal("data",
QLatin1String("nepomuk/file-indexer-error-log"), true));
+ if(errorLogFile.open(QIODevice::Append)) {
+ QTextStream s(&errorLogFile);
+ s << m_url.toLocalFile() << ": " <<
QString::fromLocal8Bit(m_process->readAllStandardOutput()) << endl;
+ }
+ }
emitResult();
}
diff --git a/services/fileindexer/nepomukindexer.h
b/services/fileindexer/nepomukindexer.h
index 5b14787..51930ba 100644
--- a/services/fileindexer/nepomukindexer.h
+++ b/services/fileindexer/nepomukindexer.h
@@ -78,7 +78,6 @@ namespace Nepomuk {
private:
KUrl m_url;
KProcess* m_process;
- int m_exitCode;
};
}
_______________________________________________
Nepomuk mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/nepomuk