Merge branch '0811-dev' into 'dev-unity'

Update pinyinWithoutTone.txt.

See merge request kylin-desktop/ukui-search!96
This commit is contained in:
纪笑旭 2021-08-20 02:08:32 +00:00
commit 1421c78e28
4 changed files with 5 additions and 40 deletions

View File

@ -95,9 +95,7 @@ void FirstIndex::DoSomething(const QFileInfo& fileInfo) {
void FirstIndex::run() { void FirstIndex::run() {
QTime t1 = QTime::currentTime(); 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. // 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 indexDataBaseStatus = IndexStatusRecorder::getInstance()->getStatus(INDEX_DATABASE_STATE).toString();
QString contentIndexDataBaseStatus = IndexStatusRecorder::getInstance()->getStatus(CONTENT_INDEX_DATABASE_STATE).toString(); QString contentIndexDataBaseStatus = IndexStatusRecorder::getInstance()->getStatus(CONTENT_INDEX_DATABASE_STATE).toString();
QString inotifyIndexStatus = IndexStatusRecorder::getInstance()->getStatus(INOTIFY_NORMAL_EXIT).toString(); QString inotifyIndexStatus = IndexStatusRecorder::getInstance()->getStatus(INOTIFY_NORMAL_EXIT).toString();
@ -106,7 +104,6 @@ void FirstIndex::run() {
qDebug() << "contentIndexDataBaseStatus: " << contentIndexDataBaseStatus; qDebug() << "contentIndexDataBaseStatus: " << contentIndexDataBaseStatus;
qDebug() << "inotifyIndexStatus: " << inotifyIndexStatus; qDebug() << "inotifyIndexStatus: " << inotifyIndexStatus;
/* || contentIndexDataBaseStatus == ""*/
if(indexDataBaseStatus == "") { if(indexDataBaseStatus == "") {
this->bool_dataBaseExist = false; this->bool_dataBaseExist = false;
} else { } else {
@ -119,9 +116,6 @@ void FirstIndex::run() {
} }
this->q_index = new QQueue<QVector<QString>>(); this->q_index = new QQueue<QVector<QString>>();
//this->q_content_index = new QQueue<QString>();
//NEW_QUEUE(this->q_content_index);
// this->mlm = new MessageListManager();
this->q_content_index = new QQueue<QPair<QString,qint64>>(); this->q_content_index = new QQueue<QPair<QString,qint64>>();
int fifo_fd; int fifo_fd;
@ -135,11 +129,6 @@ void FirstIndex::run() {
assert(false); assert(false);
} }
// this->q_content_index->enqueue(QString("/home/zhangzihao/Desktop/qwerty/四库全书.txt"));
// this->p_indexGenerator->creatAllIndex(this->q_content_index);
++FileUtils::_index_status; ++FileUtils::_index_status;
pid_t pid; pid_t pid;
pid = fork(); pid = fork();
@ -157,7 +146,6 @@ void FirstIndex::run() {
} else { } else {
// p_indexGenerator = IndexGenerator::getInstance(false,this); // p_indexGenerator = IndexGenerator::getInstance(false,this);
p_indexGenerator = IndexGenerator::getInstance(true, this); p_indexGenerator = IndexGenerator::getInstance(true, this);
} }
//TODO Fix these weird code. //TODO Fix these weird code.
QSemaphore sem(5); QSemaphore sem(5);
@ -166,7 +154,6 @@ void FirstIndex::run() {
mutex2.lock(); mutex2.lock();
mutex3.lock(); mutex3.lock();
sem.acquire(4); sem.acquire(4);
// QtConcurrent::run([&](){
sem.acquire(1); sem.acquire(1);
mutex1.unlock(); mutex1.unlock();
this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
@ -174,7 +161,6 @@ void FirstIndex::run() {
FileUtils::_max_index_count = this->q_index->length(); FileUtils::_max_index_count = this->q_index->length();
qDebug() << "max_index_count:" << FileUtils::_max_index_count; qDebug() << "max_index_count:" << FileUtils::_max_index_count;
sem.release(5); sem.release(5);
// });
QtConcurrent::run(&m_pool, [&]() { QtConcurrent::run(&m_pool, [&]() {
sem.acquire(2); sem.acquire(2);
mutex2.unlock(); mutex2.unlock();
@ -197,7 +183,6 @@ void FirstIndex::run() {
QQueue<QString>* tmp2 = new QQueue<QString>(); QQueue<QString>* tmp2 = new QQueue<QString>();
qDebug() << "q_content_index:" << q_content_index->size(); qDebug() << "q_content_index:" << q_content_index->size();
while(!this->q_content_index->empty()) { 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; qint64 fileSize = 0;
//修改一次处理的数据量从30个文件改为文件总大小为50M以下50M为暂定值--jxx20210519 //修改一次处理的数据量从30个文件改为文件总大小为50M以下50M为暂定值--jxx20210519
for(size_t i = 0;/* (i < 30) && (fileSize < 52428800) && */(!this->q_content_index->empty()); ++i) { for(size_t i = 0;/* (i < 30) && (fileSize < 52428800) && */(!this->q_content_index->empty()); ++i) {
@ -230,6 +215,8 @@ void FirstIndex::run() {
mutex2.unlock(); mutex2.unlock();
mutex3.unlock(); mutex3.unlock();
if(this->q_index) if(this->q_index)
delete this->q_index; delete this->q_index;
this->q_index = nullptr; this->q_index = nullptr;

View File

@ -35,11 +35,9 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include <syslog.h> #include <syslog.h>
//#include <QtConcurrent>
#include "traverse_bfs.h" #include "traverse_bfs.h"
#include "index-status-recorder.h" #include "index-status-recorder.h"
#include "index-generator.h" #include "index-generator.h"
#include "inotify-index.h"
#include "file-utils.h" #include "file-utils.h"
#include "common.h" #include "common.h"
namespace Zeeker { namespace Zeeker {
@ -58,31 +56,11 @@ private:
IndexGenerator* p_indexGenerator = nullptr; IndexGenerator* p_indexGenerator = nullptr;
QThreadPool m_pool; QThreadPool m_pool;
//here should be refact
// MessageListManager* mlm;
//test
QQueue<QVector<QString>>* q_index; QQueue<QVector<QString>>* q_index;
// QQueue<QString>* q_content_index; // QQueue<QString>* q_content_index;
//修改QQueue存储数据为QPair<QString,qint64>,增加存储文件大小数据便于处理时统计--jxx20210519 //修改QQueue存储数据为QPair<QString,qint64>,增加存储文件大小数据便于处理时统计--jxx20210519
QQueue<QPair<QString,qint64>>* q_content_index; QQueue<QPair<QString,qint64>>* q_content_index;
const QMap<QString, bool> targetFileTypeMap = {
std::map<QString, bool>::value_type("doc", true),
std::map<QString, bool>::value_type("docx", true),
std::map<QString, bool>::value_type("ppt", true),
std::map<QString, bool>::value_type("pptx", true),
std::map<QString, bool>::value_type("xls", true),
std::map<QString, bool>::value_type("xlsx", true),
std::map<QString, bool>::value_type("txt", true),
std::map<QString, bool>::value_type("dot", true),
std::map<QString, bool>::value_type("wps", true),
std::map<QString, bool>::value_type("pps", true),
std::map<QString, bool>::value_type("dps", true),
std::map<QString, bool>::value_type("et", true),
std::map<QString, bool>::value_type("pdf", true)
};
//xapian will auto commit per 10,000 changes, donnot change it!!! //xapian will auto commit per 10,000 changes, donnot change it!!!
const size_t u_send_length = 8192; const size_t u_send_length = 8192;
}; };

View File

@ -7280,7 +7280,7 @@ jiao 叫
shao,zhao 召 shao,zhao 召
ba,pa 叭 ba,pa 叭
ding 叮 ding 叮
ke,ge ke 可
tai,yi,si 台 tai,yi,si 台
chi,hua,e 叱 chi,hua,e 叱
shi 史 shi 史
@ -8647,7 +8647,7 @@ di,ti 奃
yan 奄 yan 奄
pao 奅 pao 奅
juan 奆 juan 奆
ji,ai,yi,qi 奇 ji,qi 奇
nai 奈 nai 奈
feng 奉 feng 奉
pi,xi,lie,xie 奊 pi,xi,lie,xie 奊

View File

@ -22,7 +22,7 @@ target.path = /usr/bin
INSTALLS += \ INSTALLS += \
target \ target \
inst1 \ inst1 \
inst2 \ inst2
HEADERS += \ HEADERS += \
sysdbusregister.h sysdbusregister.h