change position of index status from index-generator to first-index and inotify-index.

This commit is contained in:
zhangzihao 2021-01-20 17:14:14 +08:00
parent 9cb3f38d75
commit 8e42f28145
5 changed files with 9 additions and 2 deletions

View File

@ -46,6 +46,10 @@ QVector<SKeyWord> ChineseSegmentation::callSegement(QString& str)
QVector<SKeyWord> vecNeeds; QVector<SKeyWord> vecNeeds;
convert(keywordres, vecNeeds); convert(keywordres, vecNeeds);
keywordres.clear();
keywordres.shrink_to_fit();
return vecNeeds; return vecNeeds;
} }

View File

@ -107,6 +107,7 @@ void FirstIndex::run(){
// this->p_indexGenerator->creatAllIndex(this->q_content_index); // this->p_indexGenerator->creatAllIndex(this->q_content_index);
FileUtils::_index_status = CREATING_INDEX;
QSemaphore sem(5); QSemaphore sem(5);
QMutex mutex1, mutex2, mutex3; QMutex mutex1, mutex2, mutex3;
mutex1.lock(); mutex1.lock();
@ -168,6 +169,7 @@ void FirstIndex::run(){
FileUtils::_index_status = FINISH_CREATING_INDEX;
qDebug() << "sigset start!"; qDebug() << "sigset start!";
sigset( SIGTERM, handler); sigset( SIGTERM, handler);
qDebug() << "sigset end!"; qDebug() << "sigset end!";

View File

@ -77,7 +77,6 @@ bool IndexGenerator::creatAllIndex(QQueue<QVector<QString> > *messageList)
//文件内容索引 //文件内容索引
bool IndexGenerator::creatAllIndex(QQueue<QString> *messageList) bool IndexGenerator::creatAllIndex(QQueue<QString> *messageList)
{ {
FileUtils::_index_status = CREATING_INDEX;
HandlePathList(messageList); HandlePathList(messageList);
int size = _doc_list_content->size(); int size = _doc_list_content->size();
if(!size == 0) if(!size == 0)
@ -105,7 +104,6 @@ bool IndexGenerator::creatAllIndex(QQueue<QString> *messageList)
_doc_list_content = nullptr; _doc_list_content = nullptr;
} }
Q_EMIT this->transactionFinished(); Q_EMIT this->transactionFinished();
FileUtils::_index_status = FINISH_CREATING_INDEX;
return true; return true;
} }

View File

@ -121,6 +121,7 @@ void InotifyIndex::run(){
// qDebug() << "Read Event: " << currentPath[event->wd] << QString(event->name) << event->cookie << event->wd << event->mask; // qDebug() << "Read Event: " << currentPath[event->wd] << QString(event->name) << event->cookie << event->wd << event->mask;
if(event->name[0] != '.'){ if(event->name[0] != '.'){
qDebug() << QString(currentPath[event->wd] + '/' + event->name); qDebug() << QString(currentPath[event->wd] + '/' + event->name);
FileUtils::_index_status = CREATING_INDEX;
// switch (event->mask) { // switch (event->mask) {
if (event->mask & IN_CREATE){ if (event->mask & IN_CREATE){
@ -266,6 +267,7 @@ void InotifyIndex::run(){
// } // }
// } // }
/*--------------------------------*/ /*--------------------------------*/
FileUtils::_index_status = FINISH_CREATING_INDEX;
} }
next: next:
p += sizeof(struct inotify_event) + event->len; p += sizeof(struct inotify_event) + event->len;

View File

@ -8,6 +8,7 @@
#include "traverse_bfs.h" #include "traverse_bfs.h"
#include "ukui-search-qdbus.h" #include "ukui-search-qdbus.h"
#include "global-settings.h" #include "global-settings.h"
#include "file-utils.h"
#define BUF_LEN 1024 #define BUF_LEN 1024
class InotifyIndex; class InotifyIndex;