From 22fbf1883ff1978e5ed7f91bde38bc369673bb13 Mon Sep 17 00:00:00 2001 From: zhangpengfei Date: Mon, 25 Jan 2021 19:16:22 +0800 Subject: [PATCH] Optimized file search method;Update debian files about translations. --- debian/changelog | 6 ++++ debian/libukui-search0.install | 1 + libsearch/index/file-searcher.cpp | 43 +++++++++++++++-------------- libsearch/index/index-generator.cpp | 3 +- libsearch/libsearch.pro | 5 +++- src/mainwindow.cpp | 6 ++-- src/src.pro | 10 +++---- 7 files changed, 44 insertions(+), 30 deletions(-) diff --git a/debian/changelog b/debian/changelog index c625d04..803c228 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ukui-search (0.0.1+0123) v101; urgency=medium + + * Bugs Fixed. + + -- zhangpengfei Sat, 23 Jan 2021 13:53:53 +0800 + ukui-search (0.0.1+0120) v101; urgency=medium * Bugs Fixed. diff --git a/debian/libukui-search0.install b/debian/libukui-search0.install index 3de3b10..2cfc248 100644 --- a/debian/libukui-search0.install +++ b/debian/libukui-search0.install @@ -1 +1,2 @@ usr/lib/*/*.so.* +usr/share/ukui-search/translations/libsearch/*.qm diff --git a/libsearch/index/file-searcher.cpp b/libsearch/index/file-searcher.cpp index 9377112..707e435 100644 --- a/libsearch/index/file-searcher.cpp +++ b/libsearch/index/file-searcher.cpp @@ -114,7 +114,7 @@ int FileSearcher::keywordSearchfile(size_t uniqueSymbol, QString keyword, QStrin { try { - qDebug()<<"--search start--"; + qDebug()<<"--keywordSearchfile start--"; Xapian::Database db(INDEX_PATH); Xapian::Query query = creatQueryForFileSearch(keyword,db); Xapian::Enquire enquire(db); @@ -131,24 +131,24 @@ int FileSearcher::keywordSearchfile(size_t uniqueSymbol, QString keyword, QStrin queryFile = query; } - qDebug()<(result.get_matches_estimated()); - qDebug()<< "find results count=" <(result.get_matches_estimated()); if(result.size() == 0) return 0; - qDebug()<< "find results count=" < v; for(int i=0;i *messageList) Document IndexGenerator::GenerateDocument(const QVector &list) { + Document doc; // qDebug()< &list) // qDebug()<<"------------------------------------------finish"; // } /*--------------------------------------------------------------------*/ - Document doc; + doc.setData(sourcePath); doc.setUniqueTerm(uniqueterm); doc.addTerm(upTerm); diff --git a/libsearch/libsearch.pro b/libsearch/libsearch.pro index 2ae950c..84c57f5 100644 --- a/libsearch/libsearch.pro +++ b/libsearch/libsearch.pro @@ -7,7 +7,7 @@ DEFINES += LIBSEARCH_LIBRARY PKGCONFIG += gio-2.0 glib-2.0 gio-unix-2.0 gsettings-qt -CONFIG += c++11 link_pkgconfig no_keywords +CONFIG += c++11 link_pkgconfig no_keywords lrelease # The following define makes your compiler emit warnings if you use @@ -67,3 +67,6 @@ unix { INCLUDEPATH += $$PWD/../libchinese-segmentation DEPENDPATH += $$PWD/../libchinese-segmentation + +#DISTFILES += \ +# ../translations/libsearch/libukui-search_zh_CN.ts diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 64456c1..879f14b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -93,15 +93,15 @@ MainWindow::MainWindow(QWidget *parent) : m_search_result_thread = new SearchResult(this); // m_search_result_thread->start(); connect(m_search_result_thread, &SearchResult::searchResultFile, this, [ = ](QString path) { - qDebug()<<"Append a file into list: "<appendSearchItem(SearchItem::SearchType::Files, path); }); connect(m_search_result_thread, &SearchResult::searchResultDir, this, [ = ](QString path) { - qDebug()<<"Append a dir into list: "<appendSearchItem(SearchItem::SearchType::Dirs, path); }); connect(m_search_result_thread, &SearchResult::searchResultContent, this, [ = ](QPair pair) { - qDebug()<<"Append a file content into list: "<appendSearchItem(SearchItem::SearchType::Contents, pair.first, pair.second); }); diff --git a/src/src.pro b/src/src.pro index a4a1ada..3f960e2 100644 --- a/src/src.pro +++ b/src/src.pro @@ -71,8 +71,8 @@ LIBS += -L$$OUT_PWD/../libsearch -lukui-search -L$$OUT_PWD/../libchinese-segment INCLUDEPATH += $$PWD/../libsearch DEPENDPATH += $$PWD/../libsearch -DISTFILES += \ - ../data/ukui-search-menu.desktop \ - translations/bo.ts \ - translations/es.qm \ - translations/zh_CN.qm +#DISTFILES += \ +# ../data/ukui-search-menu.desktop \ +# $$OUT_PWD/.qm/bo.qm \ +# $$OUT_PWD/.qm/tr.qm \ +# $$OUT_PWD/.qm/zh_CN.qm