From 760da8a75728d831004e32377b56a8df26368de7 Mon Sep 17 00:00:00 2001 From: iaom Date: Wed, 19 Apr 2023 10:31:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=B8=80=E4=BA=9B=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BC=95=E7=94=A8=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=89=93=E5=8C=85=E7=BC=96=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/main.cpp | 1 + frontend/view/web-search-view.cpp | 1 + libsearch/file-utils.cpp | 582 +++++------------- libsearch/file-utils.h | 47 -- .../filesystemwatcher/file-system-watcher.cpp | 1 + libsearch/global-settings.cpp | 1 + libsearch/global-settings.h | 1 - libsearch/index/basic-indexer.cpp | 3 +- libsearch/index/batch-indexer.cpp | 2 + libsearch/index/file-content-indexer.cpp | 1 + libsearch/index/file-reader.cpp | 1 + .../settingsearch/settings-search-plugin.cpp | 1 + libsearch/websearch/web-search-plugin.cpp | 1 + .../ukui-search-service-dir-manager.pro | 3 +- ukui-search-service/ukui-search-service.pro | 3 +- 15 files changed, 185 insertions(+), 464 deletions(-) diff --git a/frontend/main.cpp b/frontend/main.cpp index ea41eb1..ebe1ffb 100644 --- a/frontend/main.cpp +++ b/frontend/main.cpp @@ -21,6 +21,7 @@ * */ +#include #include #include #include "ukui-search-gui.h" diff --git a/frontend/view/web-search-view.cpp b/frontend/view/web-search-view.cpp index 1bae643..fda384a 100644 --- a/frontend/view/web-search-view.cpp +++ b/frontend/view/web-search-view.cpp @@ -19,6 +19,7 @@ * */ #include +#include #include "web-search-view.h" #define MAIN_MARGINS 0,0,0,0 #define MAIN_SPACING 0 diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 681f311..04b8dd9 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -28,14 +28,180 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "gobject-template.h" #include "hanzi-to-pinyin.h" +#include "common.h" using namespace UkuiSearch; -size_t FileUtils::maxIndexCount = 0; -unsigned short FileUtils::indexStatus = 0; -QMap FileUtils::map_chinese2pinyin = QMap(); + +#define MAX_CONTENT_LENGTH 20480000 static QMutex iconMutex; +/** + * @brief 查找elem的子节点 + * @param elem 起始节点 + * @param names 名称链 + * @param nodes 查找到的全部结果 + */ +void findNodes(const QDomElement &elem, QQueue &names, QList &nodes) +{ + QString targetName = names.dequeue(); + QDomNode node = elem.firstChild(); + while (!node.isNull()) { + QDomElement e = node.toElement(); + if (!e.isNull() && e.tagName() == targetName) { + if (names.empty()) { + nodes.append(e); + + } else { + findNodes(e, names, nodes); + break; + } + } + node = node.nextSibling(); + } +} + +void findNodesByAttr(const QDomElement &elem, QQueue &names, QList &nodes, const QString &attr, const QStringList &values) +{ + findNodes(elem, names, nodes); + + QList::iterator it = nodes.begin(); + while (it != nodes.end()) { + if ((*it).hasAttribute(attr) && values.contains((*it).attribute(attr))) { + it++; + } else { + it = nodes.erase(it); + } + } +} + +bool findNodeText(const QDomElement &elem, QQueue &names, QString &content) +{ + QList nodes; + findNodes(elem, names, nodes); + + for (const auto &node : nodes) { + content.append(node.text()); + if (content.length() >= MAX_CONTENT_LENGTH / 3) { + return true; + } + } + return false; +} + +void findNodeAttr(const QDomElement &elem, QQueue &names, const QString &attr, QStringList &attrs) +{ + QList nodes; + findNodes(elem, names, nodes); + + for (const auto &node : nodes) { + if (node.hasAttribute(attr)) { + attrs.append(node.attribute(attr)); + } + } +} + +void processUOFPPT(const QDomDocument &doc, QString &content) +{ + QDomElement rootElem = doc.documentElement(); + QList nodes; + QQueue names; //每个节点的名称 + names << "uof:演示文稿" << "演:主体" << "演:幻灯片集" << "演:幻灯片"; + + findNodes(rootElem, names, nodes); + + if (nodes.empty()) { + //TODO 在uof-ppt不存在锚点节点时,直接查找文本节点? + return; + } + + QStringList objs; + //每一个 演:幻灯片 -> 锚点 + for (const auto &node : nodes) { + names.clear(); + names << "uof:锚点"; + findNodeAttr(node, names, "uof:图形引用", objs); + } + + nodes.clear(); + names.clear(); + names << "uof:对象集" << "图:图形"; + findNodesByAttr(rootElem, names, nodes, "图:标识符", objs); + + if (nodes.empty()) { + return; + } + + QList paraNodes; //全部段落节点 + for (const auto &node : nodes) { + names.clear(); + names << "图:文本内容" << "字:段落"; + findNodes(node, names, paraNodes); + } + + nodes.clear(); + for (const auto &node : paraNodes) { + names.clear(); + names << "字:句"; + findNodes(node, names, nodes); //全部段落下的全部句节点 + } + + for (const auto &node : nodes) { + names.clear(); + names << "字:文本串"; + if (findNodeText(node, names, content)) { + break; + } + } +} + +bool loadZipFileToDoc(QuaZip &zipFile, QDomDocument &doc, const QString &fileName) +{ + if (!zipFile.isOpen() && !zipFile.open(QuaZip::mdUnzip)) { + return false; + } + + if (!zipFile.setCurrentFile(fileName)) { + return false; + } + + QuaZipFile file(&zipFile); + if (!file.open(QIODevice::ReadOnly)) { + return false; + } + + doc.clear(); + if (!doc.setContent(&file)) { + file.close(); + return false; + } + file.close(); + + return true; +} FileUtils::FileUtils() { } @@ -198,24 +364,6 @@ bool FileUtils::isOrUnder(QString pathA, QString pathB) return false; } - -void FileUtils::loadHanziTable(const QString &fileName) { - QFile file(fileName); - if(!file.open(QFile::ReadOnly | QFile::Text)) { - qDebug("File: '%s' open failed!", file.fileName().toStdString().c_str()); - return; - } - - /* 读取汉字对照表文件并转换为QMap存储 */ - while(!file.atEnd()) { - QString content = QString::fromUtf8(file.readLine()); - FileUtils::map_chinese2pinyin[content.split(" ").last().trimmed()] = content.split(" ").first().split(","); - } - file.close(); - - return; -} - QMimeType FileUtils::getMimetype(const QString &path) { QMimeDatabase mdb; QMimeType type = mdb.mimeTypeForFile(path, QMimeDatabase::MatchContent); @@ -223,261 +371,8 @@ QMimeType FileUtils::getMimetype(const QString &path) { return type; } -//aborted -QString FileUtils::find(const QString &hanzi) { - // static QMap map = loadHanziTable("://index/pinyinWithoutTone.txt"); - // static QMap map; - QString output; - QStringList stringList = hanzi.split(""); - - /* 遍历查找汉字-拼音对照表的内容并将汉字替换为拼音 */ - for(const QString &str : stringList) { - if(FileUtils::map_chinese2pinyin.contains(str)) - output += FileUtils::map_chinese2pinyin[str].first(); - else - output += str; - } - - return output; -} - -//DFS多音字太多直接GG -void stitchMultiToneWordsDFS(const QString &hanzi, const QString &resultAllPinYin, const QString &resultFirst, QStringList &resultList) { - if(hanzi.size() == 0) { - resultList.append(resultAllPinYin); - resultList.append(resultFirst); - return; - } - if(FileUtils::map_chinese2pinyin.contains(hanzi.at(0))) { - for(auto i : FileUtils::map_chinese2pinyin[hanzi.at(0)]) { - stitchMultiToneWordsDFS(hanzi.right(hanzi.size() - 1), resultAllPinYin + i, resultFirst + i.at(0), resultList); - } - } else { - stitchMultiToneWordsDFS(hanzi.right(hanzi.size() - 1), resultAllPinYin + hanzi.at(0), resultFirst + hanzi.at(0), resultList); - } -} - -//BFS+Stack多音字太多会爆栈 -void stitchMultiToneWordsBFSStack(const QString &hanzi, QStringList &resultList) { - QString tempHanzi, resultAllPinYin, resultFirst; - QQueue tempQueue; - tempHanzi = hanzi; - int tempQueueSize = 0; - if(FileUtils::map_chinese2pinyin.contains(tempHanzi.at(0))) { - for(auto i : FileUtils::map_chinese2pinyin[tempHanzi.at(0)]) { - tempQueue.enqueue(i); - } - } else { - tempQueue.enqueue(tempHanzi.at(0)); - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - while(tempHanzi.size() != 0) { - tempQueueSize = tempQueue.size(); - if(FileUtils::map_chinese2pinyin.contains(tempHanzi.at(0))) { - for(int j = 0; j < tempQueueSize; ++j) { - for(auto i : FileUtils::map_chinese2pinyin[tempHanzi.at(0)]) { - tempQueue.enqueue(tempQueue.head() + i); - } - tempQueue.dequeue(); - } - } else { - for(int j = 0; j < tempQueueSize; ++j) { - tempQueue.enqueue(tempQueue.head() + tempHanzi.at(0)); - tempQueue.dequeue(); - } - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - } - while(!tempQueue.empty()) { - resultList.append(tempQueue.dequeue()); - } -} -//BFS+Heap,多音字太多会耗尽内存 -void stitchMultiToneWordsBFSHeap(const QString &hanzi, QStringList &resultList) { - QString tempHanzi, resultAllPinYin, resultFirst; - QQueue* tempQueue = new QQueue; - tempHanzi = hanzi; - int tempQueueSize = 0; - if(FileUtils::map_chinese2pinyin.contains(tempHanzi.at(0))) { - for(auto i : FileUtils::map_chinese2pinyin[tempHanzi.at(0)]) { - tempQueue->enqueue(i); - } - } else { - tempQueue->enqueue(tempHanzi.at(0)); - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - while(tempHanzi.size() != 0) { - tempQueueSize = tempQueue->size(); - if(FileUtils::map_chinese2pinyin.contains(tempHanzi.at(0))) { - for(int j = 0; j < tempQueueSize; ++j) { - for(auto i : FileUtils::map_chinese2pinyin[tempHanzi.at(0)]) { - tempQueue->enqueue(tempQueue->head() + i); - } - tempQueue->dequeue(); - } - } else { - for(int j = 0; j < tempQueueSize; ++j) { - tempQueue->enqueue(tempQueue->head() + tempHanzi.at(0)); - tempQueue->dequeue(); - } - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - } - while(!tempQueue->empty()) { - resultList.append(tempQueue->dequeue()); - } - delete tempQueue; - tempQueue = nullptr; -} - -//BFS+Heap+超过3个多音字只建一个索引,比较折中的方案 -void stitchMultiToneWordsBFSHeapLess3(const QString &hanzi, QStringList &resultList) { - QString tempHanzi, resultAllPinYin, resultFirst; - QQueue* tempQueue = new QQueue; - QQueue* tempQueueFirst = new QQueue; - tempHanzi = hanzi; - int tempQueueSize = 0; - int multiToneWordNum = 0; - for(auto i : hanzi) { - if(FileUtils::map_chinese2pinyin.contains(i)) { - if(FileUtils::map_chinese2pinyin[i].size() > 1) { - ++multiToneWordNum; - } - } - } - if(multiToneWordNum > 3) { - QString oneResult, oneResultFirst; - for(auto i : hanzi) { - if(FileUtils::map_chinese2pinyin.contains(i)) { - oneResult += FileUtils::map_chinese2pinyin[i].first(); - oneResultFirst += FileUtils::map_chinese2pinyin[i].first().at(0); - } else { - oneResult += i; - oneResultFirst += i; - } - } - resultList.append(oneResult); - resultList.append(oneResultFirst); - return; - } - - if(FileUtils::map_chinese2pinyin.contains(tempHanzi.at(0))) { - for(auto i : FileUtils::map_chinese2pinyin[tempHanzi.at(0)]) { - tempQueue->enqueue(i); - tempQueueFirst->enqueue(i.at(0)); - } - } else { - tempQueue->enqueue(tempHanzi.at(0)); - tempQueueFirst->enqueue(tempHanzi.at(0)); - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - while(tempHanzi.size() != 0) { - tempQueueSize = tempQueue->size(); - if(FileUtils::map_chinese2pinyin.contains(tempHanzi.at(0))) { - for(int j = 0; j < tempQueueSize; ++j) { - for(auto i : FileUtils::map_chinese2pinyin[tempHanzi.at(0)]) { - tempQueue->enqueue(tempQueue->head() + i); - tempQueueFirst->enqueue(tempQueueFirst->head() + i.at(0)); - } - tempQueue->dequeue(); - tempQueueFirst->dequeue(); - } - } else { - for(int j = 0; j < tempQueueSize; ++j) { - tempQueue->enqueue(tempQueue->head() + tempHanzi.at(0)); - tempQueueFirst->enqueue(tempQueueFirst->head() + tempHanzi.at(0)); - tempQueue->dequeue(); - tempQueueFirst->dequeue(); - } - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - } - while(!tempQueue->empty()) { - resultList.append(tempQueue->dequeue()); - resultList.append(tempQueueFirst->dequeue()); - } - delete tempQueue; - delete tempQueueFirst; - tempQueue = nullptr; - tempQueueFirst = nullptr; - return; -} - -//BFS+Stack+超过3个多音字只建一个索引,比较折中的方案 -void stitchMultiToneWordsBFSStackLess3(const QString &hanzi, QStringList &resultList) { - QString tempHanzi; - QQueue tempQueue; - QQueue tempQueueFirst; - tempHanzi = hanzi; - int tempQueueSize = 0; - int multiToneWordNum = 0; - - for (auto i:hanzi) { - if (HanZiToPinYin::getInstance()->isMultiTone(QString(i).toStdString())) - ++multiToneWordNum; - } - if(multiToneWordNum > 3) { - QString oneResult, oneResultFirst; - for(auto i : hanzi) { - QStringList results; - HanZiToPinYin::getInstance()->getResults(QString(i).toStdString(), results); - if(results.size()) { - oneResult += results.first(); - oneResultFirst += results.first().at(0); - } else { - oneResult += i; - oneResultFirst += i; - } - } - resultList.append(oneResult); - resultList.append(oneResultFirst); - return; - } - - QStringList results; - HanZiToPinYin::getInstance()->getResults(QString(tempHanzi.at(0)).toStdString(), results); - if(results.size()) { - for(auto i : results) { - tempQueue.enqueue(i); - tempQueueFirst.enqueue(i.at(0)); - } - } else { - tempQueue.enqueue(tempHanzi.at(0)); - tempQueueFirst.enqueue(tempHanzi.at(0)); - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - while(tempHanzi.size() != 0) { - HanZiToPinYin::getInstance()->getResults(QString(tempHanzi.at(0)).toStdString(), results); - tempQueueSize = tempQueue.size(); - if(results.size()) { - for(int j = 0; j < tempQueueSize; ++j) { - for(auto i : results) { - tempQueue.enqueue(tempQueue.head() + i); - tempQueueFirst.enqueue(tempQueueFirst.head() + i.at(0)); - } - tempQueue.dequeue(); - tempQueueFirst.dequeue(); - } - } else { - for(int j = 0; j < tempQueueSize; ++j) { - tempQueue.enqueue(tempQueue.head() + tempHanzi.at(0)); - tempQueueFirst.enqueue(tempQueueFirst.head() + tempHanzi.at(0)); - tempQueue.dequeue(); - tempQueueFirst.dequeue(); - } - } - tempHanzi = tempHanzi.right(tempHanzi.size() - 1); - } - while(!tempQueue.empty()) { - resultList.append(tempQueue.dequeue()); - resultList.append(tempQueueFirst.dequeue()); - } - return; -} - QStringList FileUtils::findMultiToneWords(const QString &hanzi) { QStringList output, results; - //stitchMultiToneWordsBFSStackLess3(hanzi, output); HanZiToPinYin::getInstance()->getResults(hanzi.toStdString(), results); QString oneResult(results.join("")); QString firstLetter; @@ -1162,124 +1057,9 @@ void FileUtils::getUOFTextContent(const QString &path, QString &textContent) file.close(); } -void FileUtils::processUOFPPT(const QDomDocument &doc, QString &content) -{ - QDomElement rootElem = doc.documentElement(); - QList nodes; - QQueue names; //每个节点的名称 - names << "uof:演示文稿" << "演:主体" << "演:幻灯片集" << "演:幻灯片"; - findNodes(rootElem, names, nodes); - if (nodes.empty()) { - //TODO 在uof-ppt不存在锚点节点时,直接查找文本节点? - return; - } - QStringList objs; - //每一个 演:幻灯片 -> 锚点 - for (const auto &node : nodes) { - names.clear(); - names << "uof:锚点"; - findNodeAttr(node, names, "uof:图形引用", objs); - } - - nodes.clear(); - names.clear(); - names << "uof:对象集" << "图:图形"; - findNodesByAttr(rootElem, names, nodes, "图:标识符", objs); - - if (nodes.empty()) { - return; - } - - QList paraNodes; //全部段落节点 - for (const auto &node : nodes) { - names.clear(); - names << "图:文本内容" << "字:段落"; - findNodes(node, names, paraNodes); - } - - nodes.clear(); - for (const auto &node : paraNodes) { - names.clear(); - names << "字:句"; - findNodes(node, names, nodes); //全部段落下的全部句节点 - } - - for (const auto &node : nodes) { - names.clear(); - names << "字:文本串"; - if (findNodeText(node, names, content)) { - break; - } - } -} - -/** - * @brief 查找elem的子节点 - * @param elem 起始节点 - * @param names 名称链 - * @param nodes 查找到的全部结果 - */ -void FileUtils::findNodes(const QDomElement &elem, QQueue &names, QList &nodes) -{ - QString targetName = names.dequeue(); - QDomNode node = elem.firstChild(); - while (!node.isNull()) { - QDomElement e = node.toElement(); - if (!e.isNull() && e.tagName() == targetName) { - if (names.empty()) { - nodes.append(e); - - } else { - findNodes(e, names, nodes); - break; - } - } - node = node.nextSibling(); - } -} - -inline void FileUtils::findNodesByAttr(const QDomElement &elem, QQueue &names, QList &nodes, const QString &attr, const QStringList &values) -{ - findNodes(elem, names, nodes); - - QList::iterator it = nodes.begin(); - while (it != nodes.end()) { - if ((*it).hasAttribute(attr) && values.contains((*it).attribute(attr))) { - it++; - } else { - it = nodes.erase(it); - } - } -} - -inline bool FileUtils::findNodeText(const QDomElement &elem, QQueue &names, QString &content) -{ - QList nodes; - findNodes(elem, names, nodes); - - for (const auto &node : nodes) { - content.append(node.text()); - if (content.length() >= MAX_CONTENT_LENGTH / 3) { - return true; - } - } - return false; -} - -inline void FileUtils::findNodeAttr(const QDomElement &elem, QQueue &names, const QString &attr, QStringList &attrs) -{ - QList nodes; - findNodes(elem, names, nodes); - - for (const auto &node : nodes) { - if (node.hasAttribute(attr)) { - attrs.append(node.attribute(attr)); - } - } -} /** * uof2.0解析 @@ -1388,30 +1168,6 @@ void FileUtils::getUOF2PPTContent(const QString &path, QString &textContent) } } -inline bool FileUtils::loadZipFileToDoc(QuaZip &zipFile, QDomDocument &doc, const QString &fileName) -{ - if (!zipFile.isOpen() && !zipFile.open(QuaZip::mdUnzip)) { - return false; - } - - if (!zipFile.setCurrentFile(fileName)) { - return false; - } - - QuaZipFile file(&zipFile); - if (!file.open(QIODevice::ReadOnly)) { - return false; - } - - doc.clear(); - if (!doc.setContent(&file)) { - file.close(); - return false; - } - file.close(); - - return true; -} /** * OFD文件解析 diff --git a/libsearch/file-utils.h b/libsearch/file-utils.h index 5fa5bc2..ee6b517 100644 --- a/libsearch/file-utils.h +++ b/libsearch/file-utils.h @@ -22,44 +22,12 @@ #ifndef FILEUTILS_H #define FILEUTILS_H #include -#include #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include - #include "libsearch_global.h" -#include "common.h" -#include -//#define INITIAL_STATE 0 -//#define CREATING_INDEX 1 -//#define FINISH_CREATING_INDEX 2 -#define MAX_CONTENT_LENGTH 20480000 namespace UkuiSearch { class LIBSEARCH_EXPORT FileUtils { public: @@ -77,12 +45,7 @@ public: static QString getSettingName(const QString &setting); //A is or under B static bool isOrUnder(QString pathA, QString pathB); - - //chinese character to pinyin - static QMap map_chinese2pinyin; - static QString find(const QString &hanzi); static QStringList findMultiToneWords(const QString &hanzi); - static void loadHanziTable(const QString &fileName); //parse text,docx..... static QMimeType getMimetype(const QString &path); @@ -110,16 +73,6 @@ public: */ static bool isEncrypedOrUnsupport(const QString &path, const QString &suffix); static bool isOcrSupportSize(QString path); - static size_t maxIndexCount; - static unsigned short indexStatus; - -private: - static void findNodes(const QDomElement &elem, QQueue &names, QList &nodes); - static inline void findNodesByAttr(const QDomElement&, QQueue&, QList&, const QString &, const QStringList&); - static inline bool findNodeText(const QDomElement &elem, QQueue &names, QString &content); - static inline void findNodeAttr(const QDomElement &elem, QQueue &names, const QString &attr, QStringList &attrs); - static void processUOFPPT(const QDomDocument &doc, QString &content); - static inline bool loadZipFileToDoc(QuaZip &zipFile, QDomDocument &doc, const QString &fileName); private: FileUtils(); diff --git a/libsearch/filesystemwatcher/file-system-watcher.cpp b/libsearch/filesystemwatcher/file-system-watcher.cpp index c4e4b89..f4fe84e 100644 --- a/libsearch/filesystemwatcher/file-system-watcher.cpp +++ b/libsearch/filesystemwatcher/file-system-watcher.cpp @@ -21,6 +21,7 @@ #include "file-system-watcher-private.h" #include #include +#include #include #include #include diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index 38e4955..85ef84a 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -21,6 +21,7 @@ #include #include #include "global-settings.h" +#define UKUI_SEARCH_SCHEMAS "org.ukui.search.settings" using namespace UkuiSearch; static GlobalSettings *globalInstance = nullptr; diff --git a/libsearch/global-settings.h b/libsearch/global-settings.h index 806ec73..c7830de 100644 --- a/libsearch/global-settings.h +++ b/libsearch/global-settings.h @@ -45,7 +45,6 @@ #define FONT_SIZE_KEY "systemFontSize" #define ICON_THEME_KEY "iconThemeName" -#define UKUI_SEARCH_SCHEMAS "org.ukui.search.settings" #define FILE_INDEX_ENABLE_KEY "fileIndexEnable" #define WEB_ENGINE_KEY "webEngine" #define CONTENT_FUZZY_SEARCH_KEY "contentFuzzySearch" diff --git a/libsearch/index/basic-indexer.cpp b/libsearch/index/basic-indexer.cpp index 87796c4..c4625fe 100644 --- a/libsearch/index/basic-indexer.cpp +++ b/libsearch/index/basic-indexer.cpp @@ -18,9 +18,10 @@ * */ #include "basic-indexer.h" -#include "file-utils.h" +#include #include #include +#include "file-utils.h" using namespace UkuiSearch; BasicIndexer::BasicIndexer(const QString& filePath): m_filePath(filePath) { diff --git a/libsearch/index/batch-indexer.cpp b/libsearch/index/batch-indexer.cpp index c2e9b81..51b9f6b 100644 --- a/libsearch/index/batch-indexer.cpp +++ b/libsearch/index/batch-indexer.cpp @@ -20,7 +20,9 @@ #include "batch-indexer.h" #include #include +#include #include +#include #include "file-utils.h" #include "basic-indexer.h" diff --git a/libsearch/index/file-content-indexer.cpp b/libsearch/index/file-content-indexer.cpp index dc989b5..585d8f9 100644 --- a/libsearch/index/file-content-indexer.cpp +++ b/libsearch/index/file-content-indexer.cpp @@ -18,6 +18,7 @@ * */ #include "file-content-indexer.h" +#include #include "file-reader.h" #include "file-utils.h" #include "chinese-segmentation.h" diff --git a/libsearch/index/file-reader.cpp b/libsearch/index/file-reader.cpp index f462efe..30c62e1 100644 --- a/libsearch/index/file-reader.cpp +++ b/libsearch/index/file-reader.cpp @@ -21,6 +21,7 @@ #include "file-utils.h" #include "binary-parser.h" #include "ocrobject.h" +#include "common.h" using namespace UkuiSearch; FileReader::FileReader(QObject *parent) : QObject(parent) { diff --git a/libsearch/settingsearch/settings-search-plugin.cpp b/libsearch/settingsearch/settings-search-plugin.cpp index bd2ac6a..1d35b13 100644 --- a/libsearch/settingsearch/settings-search-plugin.cpp +++ b/libsearch/settingsearch/settings-search-plugin.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "settings-search-plugin.h" #include "file-utils.h" diff --git a/libsearch/websearch/web-search-plugin.cpp b/libsearch/websearch/web-search-plugin.cpp index 6c2462a..1024e97 100644 --- a/libsearch/websearch/web-search-plugin.cpp +++ b/libsearch/websearch/web-search-plugin.cpp @@ -1,4 +1,5 @@ #include +#include #include "web-search-plugin.h" #include "global-settings.h" #define WEB_ENGINE_KEY "webEngine" diff --git a/ukui-search-service-dir-manager/ukui-search-service-dir-manager.pro b/ukui-search-service-dir-manager/ukui-search-service-dir-manager.pro index 506c278..bcb9e55 100644 --- a/ukui-search-service-dir-manager/ukui-search-service-dir-manager.pro +++ b/ukui-search-service-dir-manager/ukui-search-service-dir-manager.pro @@ -44,6 +44,7 @@ SOURCES += \ HEADERS += \ ukui-search-dir-manager-dbus.h -LIBS += -L$$OUT_PWD/../libsearch -lukui-search +LIBS += -L$$OUT_PWD/../libsearch -lukui-search \ + -L$$OUT_PWD/../libchinese-segmentation -lchinese-segmentation INCLUDEPATH += $$PWD/../libsearch DEPENDPATH += $$PWD/../libsearch diff --git a/ukui-search-service/ukui-search-service.pro b/ukui-search-service/ukui-search-service.pro index af4d729..861bcfe 100644 --- a/ukui-search-service/ukui-search-service.pro +++ b/ukui-search-service/ukui-search-service.pro @@ -24,7 +24,8 @@ include(../libsearch/libukui-search-headers.pri) include(../3rd-parties/qtsingleapplication/qtsingleapplication.pri) include(./qml/qml.pri) -LIBS += -L$$OUT_PWD/../libsearch -lukui-search +LIBS += -L$$OUT_PWD/../libsearch -lukui-search \ + -L$$OUT_PWD/../libchinese-segmentation -lchinese-segmentation SOURCES += \ main.cpp \