Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120827728
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
25 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/file/commitqueue.cpp b/src/file/commitqueue.cpp
index e18aff3c..96aaf324 100644
--- a/src/file/commitqueue.cpp
+++ b/src/file/commitqueue.cpp
@@ -1,96 +1,96 @@
/*
* This file is part of the KDE Baloo Project
* Copyright (C) 2013 Vishesh Handa <me@vhanda.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "commitqueue.h"
#include "lucenedocument.h"
#include <QDebug>
#include <KDiskFreeSpaceInfo>
#include <QCoreApplication>
Baloo::CommitQueue::CommitQueue(LuceneIndex *index, QObject* parent)
: QObject(parent)
, m_index(index)
{
m_smallTimer.setSingleShot(true);
m_smallTimer.setInterval(200);
connect(&m_smallTimer, &QTimer::timeout, this, &CommitQueue::commit);
m_largeTimer.setSingleShot(true);
m_largeTimer.setInterval(10000);
connect(&m_largeTimer, &QTimer::timeout, this, &CommitQueue::commit);
}
Baloo::CommitQueue::~CommitQueue()
{
commit();
}
bool Baloo::CommitQueue::isEmpty() const
{
return !m_index->haveChanges();
}
-void Baloo::CommitQueue::add(unsigned id, Xapian::Document doc)
+void Baloo::CommitQueue::add(unsigned id, Lucene::DocumentPtr doc)
{
if (id) {
LuceneDocument lDoc(doc);
QString url = lDoc.getFieldValues("URL").at(0);
m_index->replaceDocument(url, doc);
} else {
m_index->addDocument(doc);
}
startTimers();
}
void Baloo::CommitQueue::remove(const QString& url)
{
m_index->deleteDocument(url);
startTimers();
}
void Baloo::CommitQueue::startTimers()
{
m_smallTimer.start();
if (!m_largeTimer.isActive()) {
m_largeTimer.start();
}
}
void Baloo::CommitQueue::commit()
{
// The 200 mb is arbitrary
- KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(m_db->path());
+ KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(m_index->path());
if (info.isValid() && info.available() <= 200 * 1024 * 1024) {
qWarning() << "Low disk space. Aborting!!";
QCoreApplication::instance()->quit();
return;
}
m_index->commit();
m_smallTimer.stop();
m_largeTimer.stop();
Q_EMIT committed();
}
diff --git a/src/file/fileindexingjob.cpp b/src/file/fileindexingjob.cpp
index b2ce6544..f6a295f2 100644
--- a/src/file/fileindexingjob.cpp
+++ b/src/file/fileindexingjob.cpp
@@ -1,175 +1,173 @@
/*
This file is part of the Nepomuk KDE project.
Copyright (C) 2010-2011 Sebastian Trueg <trueg@kde.org>
Copyright (C) 2012-2014 Vishesh Handa <me@vhanda.in>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "fileindexingjob.h"
-#include "util.h"
#include "fileindexerconfig.h"
-#include "database.h"
#include <QDebug>
#include <QStandardPaths>
#include <QtCore/QFileInfo>
#include <QtCore/QTimer>
using namespace Baloo;
FileIndexingJob::FileIndexingJob(const QStringList& files, QObject* parent)
: KJob(parent)
, m_process(0)
, m_suspended(false)
{
Q_ASSERT(!files.isEmpty());
m_files.push(files);
setCapabilities(Suspendable);
// setup the timer used to kill the indexer process if it seems to get stuck
m_processTimer = new QTimer(this);
m_processTimer->setSingleShot(true);
connect(m_processTimer, SIGNAL(timeout()),
this, SLOT(slotProcessTimerTimeout()));
m_processTimeout = 5 * 60 * 1000;
}
void FileIndexingJob::start()
{
m_args = m_files.pop();
start(m_args);
}
void FileIndexingJob::start(const QStringList& files)
{
// setup the external process which does the actual indexing
static const QString exe = QStandardPaths::findExecutable(QLatin1String("baloo_file_extractor"));
Q_ASSERT(m_process == 0);
m_process = new QProcess(this);
QStringList args(files);
if (!m_customDbPath.isEmpty()) {
args << QLatin1String("--db") << m_customDbPath;
args << QLatin1String("--ignoreConfig");
}
qDebug() << args;
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(slotIndexedFile(int,QProcess::ExitStatus)));
m_process->setProcessChannelMode(QProcess::SeparateChannels);
m_process->start(exe, args);
m_processTimer->start(m_processTimeout);
}
void FileIndexingJob::slotIndexedFile(int, QProcess::ExitStatus exitStatus)
{
// stop the timer since there is no need to kill the process anymore
m_processTimer->stop();
m_process->disconnect(this);
m_process->deleteLater();
m_process = 0;
if (exitStatus == QProcess::NormalExit) {
if (m_files.isEmpty()) {
emitResult();
} else {
m_args = m_files.pop();
if (!m_suspended) {
start(m_args);
}
}
return;
}
// Failed to index. We must figure out which was the offending file
qDebug() << "Indexing failed. Trying to determine offending file";
// Here it is!
if (m_args.size() == 1) {
- QString doc = m_args.first();
+ const QString doc = m_args.first();
qWarning() << "Indexer crashed while indexing" << doc;
qWarning() << "Blacklisting this file";
Q_EMIT indexingFailed(doc);
if (m_files.isEmpty()) {
emitResult();
} else {
m_args = m_files.pop();
if (!m_suspended) {
start(m_args);
}
}
return;
}
// We split the args into half and push the rest back into m_files
// to call later
int s = m_args.size() / 2;
m_files.push(m_args.mid(s));
for (int i = 0; i < s; ++i) {
m_args.pop_back();
}
if (!m_suspended) {
start(m_args);
}
}
void FileIndexingJob::slotProcessTimerTimeout()
{
// Emulate a crash so that we narrow down the file which is taking too long
qDebug() << "Process took too long killing";
slotIndexedFile(1, QProcess::CrashExit);
}
void FileIndexingJob::setCustomDbPath(const QString& path)
{
m_customDbPath = path;
}
void FileIndexingJob::setTimeoutInterval(int msec)
{
m_processTimeout = msec;
}
bool FileIndexingJob::doSuspend()
{
if (m_suspended)
return false;
m_suspended = true;
return true;
}
bool FileIndexingJob::doResume()
{
if (!m_suspended)
return false;
m_suspended = false;
if (!m_process)
start(m_args);
return true;
}
diff --git a/src/file/fileindexingjob.h b/src/file/fileindexingjob.h
index 6316b3e3..9a3a8acc 100644
--- a/src/file/fileindexingjob.h
+++ b/src/file/fileindexingjob.h
@@ -1,95 +1,95 @@
/*
This file is part of the Nepomuk KDE project.
Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
Copyrigth (C) 2013 Vishesh Handa <me@vhanda.in>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BALOO_INDEXING_JOB_H_
#define _BALOO_INDEXING_JOB_H_
#include <KJob>
#include <QProcess>
#include <QVector>
#include <QStack>
#include "filemapping.h"
class QTimer;
namespace Baloo
{
class FileIndexingJob : public KJob
{
Q_OBJECT
public:
FileIndexingJob(const QStringList& files, QObject* parent = 0);
/**
* Set a custom path which should be sent to the baloo_file_extractor
* to use for the database. This is useful when debugging.
*/
void setCustomDbPath(const QString& path);
/**
* Set the maximum number of msecs that each file should take in order
* to get indexed. If a file takes longer, then it will be marked
* as failing and the indexingFailed signal will be called
*
* By deafult this is 5 minutes
*/
void setTimeoutInterval(int msec);
virtual void start();
Q_SIGNALS:
/**
* This signal is emitted when the indexing fails on a particular document
*/
- void indexingFailed(QString& path);
+ void indexingFailed(const QString& url);
protected:
virtual bool doSuspend();
virtual bool doResume();
private Q_SLOTS:
void slotIndexedFile(int exitCode, QProcess::ExitStatus exitStatus);
void slotProcessTimerTimeout();
private:
- void start(const QVector<QString>& files);
+ void start(const QStringList& files);
/// holds the files which still need to be indexed
QStack<QStringList> m_files;
/// holds the files which have been sent to the process
QStringList m_args;
QProcess* m_process;
QTimer* m_processTimer;
int m_processTimeout;
QString m_customDbPath;
bool m_suspended;
};
}
#endif
diff --git a/src/file/fileindexingqueue.cpp b/src/file/fileindexingqueue.cpp
index f52ddceb..b02c7640 100644
--- a/src/file/fileindexingqueue.cpp
+++ b/src/file/fileindexingqueue.cpp
@@ -1,136 +1,135 @@
/*
* This file is part of the KDE Baloo Project
* Copyright (C) 2012-2013 Vishesh Handa <me@vhanda.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "fileindexingqueue.h"
#include "fileindexingjob.h"
-#include "util.h"
-#include "database.h"
#include "filemapping.h"
#include <QStandardPaths>
#include <QDebug>
+#include <QString>
#include "lucenedocument.h"
using namespace Baloo;
FileIndexingQueue::FileIndexingQueue(LuceneIndex *index, QObject* parent)
: IndexingQueue(parent)
, m_index(index)
, m_testMode(false)
, m_indexJob(0)
{
m_maxSize = 1200;
m_batchSize = 40;
m_reader = index->IndexReader();
m_fileQueue.reserve(m_maxSize);
}
void FileIndexingQueue::fillQueue()
{
if (m_fileQueue.size() >= m_maxSize)
return;
// We do not want to refill the queue when a job is going on
// this will result in unnecessary duplicates
if (m_indexJob)
return;
Lucene::SearcherPtr searcher = Lucene::newLucene<Lucene::IndexSearcher>(m_reader);
Lucene::TermPtr term = Lucene::newLucene<Lucene::Term>(L"Z", L"1");
Lucene::TermQueryPtr query = Lucene::newLucene<Lucene::TermQuery>(term);
Lucene::TopDocsPtr topdocs = searcher->search(query, m_maxSize - m_fileQueue.size());
Lucene::Collection<Lucene::ScoreDocPtr> scoreDocs = topdocs->scoreDocs;
Lucene::Collection<Lucene::ScoreDocPtr>::iterator it = scoreDocs.begin();
for (; it != scoreDocs.end(); ++it) {
- LuceneDocument doc(m_reader->document(*it->doc));
+ Lucene::ScoreDocPtr scoreDoc = *it;
+ LuceneDocument doc(m_reader->document(scoreDoc->doc));
m_fileQueue << doc.getFieldValues("URL").at(0);
}
}
bool FileIndexingQueue::isEmpty()
{
return m_fileQueue.isEmpty();
}
void FileIndexingQueue::processNextIteration()
{
QStringList files;
files.reserve(m_batchSize);
for (int i=0; i<m_batchSize && m_fileQueue.size(); ++i) {
files << m_fileQueue.pop();
}
Q_ASSERT(m_indexJob == 0);
m_indexJob = new FileIndexingJob(files, this);
if (m_testMode) {
- m_indexJob->setCustomDbPath(m_testModePath);
+ m_indexJob->setCustomDbPath(m_index->path());
}
connect(m_indexJob, &FileIndexingJob::indexingFailed, this, &FileIndexingQueue::slotIndexingFailed);
connect(m_indexJob, &FileIndexingJob::finished, this, &FileIndexingQueue::slotFinishedIndexingFile);
m_indexJob->start();
}
void FileIndexingQueue::slotFinishedIndexingFile(KJob* job)
{
Q_ASSERT(job == m_indexJob);
m_indexJob = 0;
// The process would have modified the db
m_reader->reopen();
if (m_fileQueue.isEmpty()) {
fillQueue();
}
finishIteration();
}
-void FileIndexingQueue::slotIndexingFailed(QString& path)
+void FileIndexingQueue::slotIndexingFailed(const QString& url)
{
m_reader->reopen();
- LuceneDocument doc;
- FileMapping map(path);
+ FileMapping map(url);
map.fetch(m_reader);
LuceneDocument doc(m_reader->document(map.id()));
doc.removeFields("Z");
doc.addIndexedField("Z", "-1");
- Q_EMIT newDocument(map.id(), doc);
+ Q_EMIT newDocument(map.id(), doc.doc());
}
void FileIndexingQueue::clear()
{
m_fileQueue.clear();
}
void FileIndexingQueue::doResume()
{
if (m_indexJob)
m_indexJob->resume();
}
void FileIndexingQueue::doSuspend()
{
if (m_indexJob)
m_indexJob->suspend();
}
diff --git a/src/file/fileindexingqueue.h b/src/file/fileindexingqueue.h
index c38f2fa2..96df4921 100644
--- a/src/file/fileindexingqueue.h
+++ b/src/file/fileindexingqueue.h
@@ -1,80 +1,80 @@
/*
* This file is part of the KDE Baloo Project
* Copyright (C) 2013 Vishesh Handa <me@vhanda.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3, or any
* later version accepted by the membership of KDE e.V. (or its
* successor approved by the membership of KDE e.V.), which shall
* act as a proxy defined in Section 6 of version 3 of the license.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef FILEINDEXINGQUEUE_H
#define FILEINDEXINGQUEUE_H
#include "indexingqueue.h"
#include "filemapping.h"
#include "luceneindex.h"
#include <QStack>
#include <KJob>
class Database;
namespace Baloo
{
class FileIndexingJob;
class FileIndexingQueue : public IndexingQueue
{
Q_OBJECT
public:
FileIndexingQueue(LuceneIndex *index, QObject* parent = 0);
virtual bool isEmpty();
virtual void fillQueue();
void clear();
void setMaxSize(int size) { m_maxSize = size; }
void setBatchSize(int size) { m_batchSize = size; }
- void setTestMode(bool mode, QString path = QString()) { m_testMode = mode; m_testModePath = QString(); }
+ void setTestMode(bool mode) { m_testMode = mode; }
Q_SIGNALS:
void newDocument(uint docid, const Lucene::DocumentPtr doc);
protected:
virtual void processNextIteration();
virtual void doSuspend();
virtual void doResume();
private Q_SLOTS:
void slotFinishedIndexingFile(KJob* job);
- void slotIndexingFailed(uint doc);
+ void slotIndexingFailed(const QString& url);
private:
QStack<QString> m_fileQueue;
LuceneIndex *m_index;
Lucene::IndexReaderPtr m_reader;
int m_maxSize;
int m_batchSize;
bool m_testMode;
QString m_testModePath;
FileIndexingJob* m_indexJob;
};
}
#endif // FILEINDEXINGQUEUE_H
diff --git a/src/lucene/lucenedocument.cpp b/src/lucene/lucenedocument.cpp
index 6724882b..d7a8f445 100644
--- a/src/lucene/lucenedocument.cpp
+++ b/src/lucene/lucenedocument.cpp
@@ -1,85 +1,85 @@
#include "lucenedocument.h"
#include <QStringList>
using namespace Baloo;
LuceneDocument::LuceneDocument()
{
m_doc = Lucene::newLucene<Lucene::Document>();
}
LuceneDocument::LuceneDocument(const Lucene::DocumentPtr& doc)
: m_doc(doc)
{
}
void LuceneDocument::addField(const QString& field, const QString& value, Lucene::Field::Store store,
Lucene::Field::Index index)
{
m_doc->add(Lucene::newLucene<Lucene::Field>(field.toStdWString(), value.toStdWString(), store, index));
}
void LuceneDocument::addField(const QString& field, const int value, Lucene::Field::Store store,
Lucene::Field::Index index)
{
addField(field, QString::number(value), store, index);
}
void LuceneDocument::addIndexedField(const QString& field, const QString& value, bool stored)
{
if (stored) {
addField(field, value, Lucene::Field::STORE_YES, Lucene::Field::INDEX_NOT_ANALYZED);
}
else {
addField(field, value, Lucene::Field::STORE_NO, Lucene::Field::INDEX_NOT_ANALYZED);
}
}
void LuceneDocument::addNumericField(const QString& name, long int value, bool storeLong)
{
Lucene::NumericFieldPtr numericField = Lucene::newLucene<Lucene::NumericField>(name.toStdWString());
if (storeLong) {
numericField->setLongValue(value);
}
else {
numericField->setIntValue(value);
}
m_doc->add(numericField);
}
void LuceneDocument::indexText(const QString& term, const QString& prefix)
{
addField(prefix, term, Lucene::AbstractField::STORE_YES, Lucene::AbstractField::INDEX_ANALYZED);
//TODO check what sort of analyzer lucene uses by default
}
QStringList LuceneDocument::getFieldValues(const QString& field)
{
Lucene::Collection<Lucene::String> values = m_doc->getValues(field.toStdWString());
QStringList vals;
for (Lucene::Collection<Lucene::String>::iterator it = values.begin(); it != values.end(); ++it) {
vals << QString::fromStdWString(*it);
}
return vals;
}
-bool LuceneDocument::removeFields(QString& field)
+bool LuceneDocument::removeFields(const QString& field)
{
bool modified = true;
if (!m_doc->getField(field.toStdWString())) {
modified = false;
}
else {
m_doc->removeFields(field.toStdWString());
}
return modified;
}
Lucene::DocumentPtr LuceneDocument::doc() const
{
return m_doc;
}
diff --git a/src/lucene/lucenedocument.h b/src/lucene/lucenedocument.h
index e001174a..40002173 100644
--- a/src/lucene/lucenedocument.h
+++ b/src/lucene/lucenedocument.h
@@ -1,35 +1,35 @@
#ifndef BALOO_LUCENEDOCUMENT_H
#define BALOO_LUCENEDOCUMENT_H
#include <lucene++/LuceneHeaders.h>
#include <QString>
#include "lucene_export.h"
namespace Baloo {
/**
* This class is a wraper over a lucene doc for providing Qt APIs
*/
class BALOO_LUCENE_EXPORT LuceneDocument
{
public:
LuceneDocument();
LuceneDocument(const Lucene::DocumentPtr& doc);
void addIndexedField(const QString& field, const QString& value, bool stored = 1);
void addNumericField( const QString& name, long int value, bool storeLong = 0);
void indexText(const QString& term, const QString& prefix = QStringLiteral("content"));
Lucene::DocumentPtr doc() const;
QStringList getFieldValues(const QString& field);
- bool removeFields(QString& field);
+ bool removeFields(const QString& field);
private:
Lucene::DocumentPtr m_doc;
void addField(const QString &field, const QString &value, Lucene::Field::Store store,
Lucene::Field::Index index);
void addField(const QString& field, int value, Lucene::Field::Store store,
Lucene::Field::Index index);
};
}
#endif //BALOO_LUCENEDOCUMENT_H
diff --git a/src/lucene/luceneindex.cpp b/src/lucene/luceneindex.cpp
index 315b41d3..ccf09ed2 100644
--- a/src/lucene/luceneindex.cpp
+++ b/src/lucene/luceneindex.cpp
@@ -1,77 +1,78 @@
#include "luceneindex.h"
#include <QDebug>
#include <QString>
using namespace Baloo;
LuceneIndex::LuceneIndex(const QString& path)
+ : m_path(path)
{
try {
m_indexWriter = Lucene::newLucene<Lucene::IndexWriter>(Lucene::FSDirectory::open(path.toStdWString()),
Lucene::newLucene<Lucene::StandardAnalyzer>(Lucene::LuceneVersion::LUCENE_CURRENT),
Lucene::IndexWriter::DEFAULT_MAX_FIELD_LENGTH);
}
catch (Lucene::LuceneException& e) {
qWarning() << "Exception:" << e.getError().c_str();
}
}
LuceneIndex::~LuceneIndex()
{
}
void LuceneIndex::addDocument(LuceneDocument& doc)
{
addDocument(doc.doc());
}
void LuceneIndex::addDocument(Lucene::DocumentPtr doc)
{
try {
m_indexWriter->addDocument(doc);
}
catch (Lucene::LuceneException &e) {
qWarning() << "Exception" << e.getError().c_str();
}
m_haveChanges = true;
}
void LuceneIndex::replaceDocument(const QString& url, const Lucene::DocumentPtr& doc)
{
m_indexWriter->updateDocument(makeTerm(QStringLiteral("URL"), url), doc);
m_haveChanges = true;
}
void LuceneIndex::deleteDocument(const QString& url)
{
m_indexWriter->deleteDocuments( makeTerm(QStringLiteral("URL"), url) );
}
Lucene::TermPtr LuceneIndex::makeTerm(const QString& field, const QString& value)
{
Lucene::TermPtr term = Lucene::newLucene<Lucene::Term>(field.toStdWString(), value.toStdWString());
return term;
}
Lucene::IndexReaderPtr LuceneIndex::IndexReader()
{
return m_indexWriter->getReader();
}
void LuceneIndex::commit(bool optimize)
{
try {
if (optimize){
m_indexWriter->optimize();
}
m_indexWriter->commit();
}
catch (Lucene::LuceneException &e) {
qWarning() << "Exception" << e.getError().c_str();
}
m_haveChanges = false;
}
diff --git a/src/lucene/luceneindex.h b/src/lucene/luceneindex.h
index 8dd5bbe9..86588263 100644
--- a/src/lucene/luceneindex.h
+++ b/src/lucene/luceneindex.h
@@ -1,30 +1,32 @@
#ifndef BALOO_LUCENEINDEXWRITER_H
#define BALOO_LUCENEINDEXWRITER_H
#include <lucene++/LuceneHeaders.h>
#include "lucenedocument.h"
#include "lucene_export.h"
namespace Baloo {
class BALOO_LUCENE_EXPORT LuceneIndex {
public:
LuceneIndex(const QString& path);
~LuceneIndex();
void addDocument(LuceneDocument& doc);
void addDocument(Lucene::DocumentPtr doc);
void replaceDocument(const QString& url, const Lucene::DocumentPtr& doc);
void deleteDocument(const QString& url);
void commit(bool optimize = 0);
bool haveChanges() { return m_haveChanges; }
Lucene::TermPtr makeTerm(const QString& field, const QString& value);
Lucene::IndexWriterPtr indexWriter() { return m_indexWriter; }
+ QString path() { return m_path; }
Lucene::IndexReaderPtr IndexReader();
private:
Lucene::IndexWriterPtr m_indexWriter;
bool m_haveChanges = false;
+ QString m_path;
};
}
#endif // BALOO_LUCENEINDEXWRITER_H
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Apr 24, 11:16 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18896575
Default Alt Text
(25 KB)
Attached To
Mode
rKB baloo
Attached
Detach File
Event Timeline