forked from openkylin/ukui-search
Merge pull request #86 from iaom/0115-dev
Add function of querying current index count.
This commit is contained in:
commit
e0261a1a10
|
@ -1,3 +1,4 @@
|
|||
usr/bin/ukui-search
|
||||
etc/xdg/autostart/*.desktop
|
||||
usr/share/applications/*.desktop
|
||||
usr/share/ukui-search/translations/*.qm
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
static void getDocxTextContent(QString &path, QString &textcontent);
|
||||
static void getTxtContent(QString &path, QString &textcontent);
|
||||
static size_t _max_index_count;
|
||||
static size_t _current_index_count;
|
||||
static size_t _current_index_count; //this one has been Abandoned,do not use it.
|
||||
static unsigned short _index_status;
|
||||
|
||||
private:
|
||||
|
|
|
@ -20,6 +20,12 @@ FileSearcher::~FileSearcher()
|
|||
{
|
||||
}
|
||||
|
||||
int FileSearcher::getCurrentIndexCount()
|
||||
{
|
||||
Xapian::Database db(INDEX_PATH);
|
||||
return db.get_doccount();
|
||||
}
|
||||
|
||||
void FileSearcher::onKeywordSearch(QString keyword,QQueue<QString> *searchResultFile,QQueue<QString> *searchResultDir,QQueue<QPair<QString,QStringList>> *searchResultContent)
|
||||
{
|
||||
m_mutex1.lock();
|
||||
|
|
|
@ -20,6 +20,8 @@ public:
|
|||
explicit FileSearcher(QObject *parent = nullptr);
|
||||
~FileSearcher();
|
||||
|
||||
int getCurrentIndexCount();
|
||||
|
||||
static size_t uniqueSymbol1;
|
||||
static size_t uniqueSymbol2;
|
||||
static size_t uniqueSymbol3;
|
||||
|
|
|
@ -56,7 +56,6 @@ bool IndexGenerator::creatAllIndex(QQueue<QVector<QString> > *messageList)
|
|||
count = 0;
|
||||
m_datebase_path->commit();
|
||||
}
|
||||
FileUtils::_current_index_count += 1;
|
||||
}
|
||||
m_datebase_path->commit();
|
||||
}
|
||||
|
@ -65,7 +64,7 @@ bool IndexGenerator::creatAllIndex(QQueue<QVector<QString> > *messageList)
|
|||
qWarning()<<"creatAllIndex fail!"<<QString::fromStdString(e.get_description());
|
||||
//need a record
|
||||
GlobalSettings::getInstance()->setValue(INDEX_DATABASE_STATE,"1");
|
||||
Q_ASSERT(false);
|
||||
assert(false);
|
||||
}
|
||||
m_doc_list_path->clear();
|
||||
Q_EMIT this->transactionFinished();
|
||||
|
@ -96,7 +95,7 @@ bool IndexGenerator::creatAllIndex(QQueue<QString> *messageList)
|
|||
{
|
||||
qWarning()<<"creat content Index fail!"<<QString::fromStdString(e.get_description());
|
||||
GlobalSettings::getInstance()->setValue(CONTENT_INDEX_DATABASE_STATE,"1");
|
||||
Q_ASSERT(false);
|
||||
assert(false);
|
||||
}
|
||||
m_doc_list_content->clear();
|
||||
Q_EMIT this->transactionFinished();
|
||||
|
@ -361,9 +360,6 @@ bool IndexGenerator::deleteAllIndex(QStringList *pathlist)
|
|||
qDebug()<<"delete path"<<doc;
|
||||
qDebug()<<"delete md5"<<QString::fromStdString(uniqueterm);
|
||||
m_datebase_path->commit();
|
||||
|
||||
FileUtils::_current_index_count = m_datebase_path->get_doccount();
|
||||
|
||||
qDebug()<< "--delete finish--";
|
||||
}
|
||||
catch(const Xapian::Error &e)
|
||||
|
|
Loading…
Reference in New Issue