diff --git a/libchinese-segmentation b/libchinese-segmentation index 124c661..bf085a4 160000 --- a/libchinese-segmentation +++ b/libchinese-segmentation @@ -1 +1 @@ -Subproject commit 124c661581e0f2e10a47d3cc237f7ade404f1bec +Subproject commit bf085a4a188010fac212e0f80e133c777857552b diff --git a/libsearch/index/file-content-indexer.cpp b/libsearch/index/file-content-indexer.cpp index ee488a4..5112459 100644 --- a/libsearch/index/file-content-indexer.cpp +++ b/libsearch/index/file-content-indexer.cpp @@ -41,9 +41,8 @@ bool fileContentIndexer::index() } m_document.setData(content); - //'\xEF\xBC\x8C' is "," "\xE3\x80\x82" is "。" use three " " to replace ,to ensure the offset info. - content = content.replace("\t", " ").replace("\xEF\xBC\x8C", " ").replace("\xE3\x80\x82", " "); - std::vector term = ChineseSegmentation::getInstance()->callSegment(content.left(20480000).toStdString()); + + std::vector term = ChineseSegmentation::getInstance()->callSegment(content.left(20480000)); content.clear(); content.squeeze(); diff --git a/libsearch/index/search-manager.cpp b/libsearch/index/search-manager.cpp index dd3aff9..e6aa032 100644 --- a/libsearch/index/search-manager.cpp +++ b/libsearch/index/search-manager.cpp @@ -274,7 +274,7 @@ int FileContentSearch::keywordSearchContent() { qp.set_default_op(Xapian::Query::OP_AND); qp.set_database(db); - std::vector sKeyWord = ChineseSegmentation::getInstance()->callSegment(m_keyword.toStdString()); + std::vector sKeyWord = ChineseSegmentation::getInstance()->callSegment(m_keyword); //Creat a query std::string words; for(size_t i = 0; i < sKeyWord.size(); i++) { @@ -414,7 +414,7 @@ int OcrSearch::keywordSearchOcr() { Xapian::QueryParser qp; qp.set_default_op(Xapian::Query::OP_AND); qp.set_database(db); - std::vector sKeyWord = ChineseSegmentation::getInstance()->callSegment(m_keyword.toStdString()); + std::vector sKeyWord = ChineseSegmentation::getInstance()->callSegment(m_keyword); //Creat a query std::string words; for(int i = 0; i < sKeyWord.size(); i++) { diff --git a/libsearch/notesearch/note-search-plugin.cpp b/libsearch/notesearch/note-search-plugin.cpp index 274441b..916d61e 100644 --- a/libsearch/notesearch/note-search-plugin.cpp +++ b/libsearch/notesearch/note-search-plugin.cpp @@ -180,7 +180,7 @@ NoteSearch::NoteSearch(DataQueue *searchResult, c } void NoteSearch::run() { - std::vector sKeyWordVec = ChineseSegmentation::getInstance()->callSegment(m_keyword.toStdString()); + std::vector sKeyWordVec = ChineseSegmentation::getInstance()->callSegment(m_keyword); QStringList keywordList; for (KeyWord sKeyWord : sKeyWordVec) { keywordList.append(QString::fromStdString(sKeyWord.word)); diff --git a/libsearch/searchinterface/searchtasks/file-content-search-task.cpp b/libsearch/searchinterface/searchtasks/file-content-search-task.cpp index c447e62..814907f 100644 --- a/libsearch/searchinterface/searchtasks/file-content-search-task.cpp +++ b/libsearch/searchinterface/searchtasks/file-content-search-task.cpp @@ -179,8 +179,8 @@ inline Xapian::Query FileContentSearchWorker::createQuery() { std::vector v; - for (const auto &keyword : m_searchController->getKeyword()) { - std::vector sKeyWord = ChineseSegmentation::getInstance()->callSegment(keyword.toStdString()); + for (auto &keyword : m_searchController->getKeyword()) { + std::vector sKeyWord = ChineseSegmentation::getInstance()->callSegment(keyword); for(const auto & c : sKeyWord) { v.emplace_back(c.word);