diff --git a/libsearch/index/first-index.cpp b/libsearch/index/first-index.cpp index 15f6429..59a44b1 100644 --- a/libsearch/index/first-index.cpp +++ b/libsearch/index/first-index.cpp @@ -95,9 +95,7 @@ void FirstIndex::DoSomething(const QFileInfo& fileInfo) { void FirstIndex::run() { QTime t1 = QTime::currentTime(); - // Create a fifo at ~/.config/org.ukui/ukui-search, the fifo is used to control the order of child processes' running. - QString indexDataBaseStatus = IndexStatusRecorder::getInstance()->getStatus(INDEX_DATABASE_STATE).toString(); QString contentIndexDataBaseStatus = IndexStatusRecorder::getInstance()->getStatus(CONTENT_INDEX_DATABASE_STATE).toString(); QString inotifyIndexStatus = IndexStatusRecorder::getInstance()->getStatus(INOTIFY_NORMAL_EXIT).toString(); @@ -106,7 +104,6 @@ void FirstIndex::run() { qDebug() << "contentIndexDataBaseStatus: " << contentIndexDataBaseStatus; qDebug() << "inotifyIndexStatus: " << inotifyIndexStatus; - /* || contentIndexDataBaseStatus == ""*/ if(indexDataBaseStatus == "") { this->bool_dataBaseExist = false; } else { @@ -119,9 +116,6 @@ void FirstIndex::run() { } this->q_index = new QQueue>(); - //this->q_content_index = new QQueue(); - //NEW_QUEUE(this->q_content_index); -// this->mlm = new MessageListManager(); this->q_content_index = new QQueue>(); int fifo_fd; @@ -135,11 +129,6 @@ void FirstIndex::run() { assert(false); } -// this->q_content_index->enqueue(QString("/home/zhangzihao/Desktop/qwerty/四库全书.txt")); - -// this->p_indexGenerator->creatAllIndex(this->q_content_index); - - ++FileUtils::_index_status; pid_t pid; pid = fork(); @@ -157,7 +146,6 @@ void FirstIndex::run() { } else { // p_indexGenerator = IndexGenerator::getInstance(false,this); p_indexGenerator = IndexGenerator::getInstance(true, this); - } //TODO Fix these weird code. QSemaphore sem(5); @@ -166,7 +154,6 @@ void FirstIndex::run() { mutex2.lock(); mutex3.lock(); sem.acquire(4); -// QtConcurrent::run([&](){ sem.acquire(1); mutex1.unlock(); this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); @@ -174,7 +161,6 @@ void FirstIndex::run() { FileUtils::_max_index_count = this->q_index->length(); qDebug() << "max_index_count:" << FileUtils::_max_index_count; sem.release(5); -// }); QtConcurrent::run(&m_pool, [&]() { sem.acquire(2); mutex2.unlock(); @@ -197,7 +183,6 @@ void FirstIndex::run() { QQueue* tmp2 = new QQueue(); qDebug() << "q_content_index:" << q_content_index->size(); while(!this->q_content_index->empty()) { - // for (size_t i = 0; (i < this->u_send_length) && (!this->q_content_index->empty()); ++i){ qint64 fileSize = 0; //修改一次处理的数据量,从30个文件改为文件总大小为50M以下,50M为暂定值--jxx20210519 for(size_t i = 0;/* (i < 30) && (fileSize < 52428800) && */(!this->q_content_index->empty()); ++i) { @@ -230,6 +215,8 @@ void FirstIndex::run() { mutex2.unlock(); mutex3.unlock(); + + if(this->q_index) delete this->q_index; this->q_index = nullptr; diff --git a/libsearch/index/first-index.h b/libsearch/index/first-index.h index ab1d23e..9275260 100644 --- a/libsearch/index/first-index.h +++ b/libsearch/index/first-index.h @@ -35,11 +35,9 @@ #include #include #include -//#include #include "traverse_bfs.h" #include "index-status-recorder.h" #include "index-generator.h" -#include "inotify-index.h" #include "file-utils.h" #include "common.h" namespace Zeeker { @@ -58,31 +56,11 @@ private: IndexGenerator* p_indexGenerator = nullptr; QThreadPool m_pool; - //here should be refact -// MessageListManager* mlm; - - //test QQueue>* q_index; // QQueue* q_content_index; //修改QQueue存储数据为QPair,增加存储文件大小数据便于处理时统计--jxx20210519 QQueue>* q_content_index; - const QMap targetFileTypeMap = { - std::map::value_type("doc", true), - std::map::value_type("docx", true), - std::map::value_type("ppt", true), - std::map::value_type("pptx", true), - std::map::value_type("xls", true), - std::map::value_type("xlsx", true), - std::map::value_type("txt", true), - std::map::value_type("dot", true), - std::map::value_type("wps", true), - std::map::value_type("pps", true), - std::map::value_type("dps", true), - std::map::value_type("et", true), - std::map::value_type("pdf", true) - }; - //xapian will auto commit per 10,000 changes, donnot change it!!! const size_t u_send_length = 8192; }; diff --git a/libsearch/index/pinyinWithoutTone.txt b/libsearch/index/pinyinWithoutTone.txt index 5477369..5c1af9c 100644 --- a/libsearch/index/pinyinWithoutTone.txt +++ b/libsearch/index/pinyinWithoutTone.txt @@ -7280,7 +7280,7 @@ jiao 叫 shao,zhao 召 ba,pa 叭 ding 叮 -ke,ge 可 +ke 可 tai,yi,si 台 chi,hua,e 叱 shi 史 @@ -8647,7 +8647,7 @@ di,ti 奃 yan 奄 pao 奅 juan 奆 -ji,ai,yi,qi 奇 +ji,qi 奇 nai 奈 feng 奉 pi,xi,lie,xie 奊 diff --git a/ukuisearch-systemdbus/ukuisearch-systemdbus.pro b/ukuisearch-systemdbus/ukuisearch-systemdbus.pro index 8ceb141..623a8b5 100644 --- a/ukuisearch-systemdbus/ukuisearch-systemdbus.pro +++ b/ukuisearch-systemdbus/ukuisearch-systemdbus.pro @@ -22,7 +22,7 @@ target.path = /usr/bin INSTALLS += \ target \ inst1 \ - inst2 \ + inst2 HEADERS += \ sysdbusregister.h