From 6465ea2457b8048be73591873fa47502334ffd95 Mon Sep 17 00:00:00 2001 From: zhangpengfei Date: Tue, 12 Jan 2021 18:54:51 +0800 Subject: [PATCH] Add index count; [Fix] Duplicate index issue. --- libsearch/index/document.cpp | 2 +- libsearch/index/index-generator.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libsearch/index/document.cpp b/libsearch/index/document.cpp index 95056b8..92cb446 100644 --- a/libsearch/index/document.cpp +++ b/libsearch/index/document.cpp @@ -45,7 +45,7 @@ void Document::setUniqueTerm(QString term) { if(term.isEmpty()) return; -// m_document->add_term(term.toStdString()); + m_document->add_term(term.toStdString()); m_unique_term = new QString(term); } diff --git a/libsearch/index/index-generator.cpp b/libsearch/index/index-generator.cpp index de0a937..488b13a 100644 --- a/libsearch/index/index-generator.cpp +++ b/libsearch/index/index-generator.cpp @@ -56,6 +56,7 @@ bool IndexGenerator::creatAllIndex(QQueue > *messageList) count = 0; m_datebase_path->commit(); } + FileUtils::_current_index_count += 1; } m_datebase_path->commit(); } @@ -353,6 +354,7 @@ bool IndexGenerator::deleteAllIndex(QStringList *pathlist) qDebug()<<"delete path"<commit(); + FileUtils::_current_index_count -= 1; qDebug()<< "--delete finish--"; } catch(const Xapian::Error &e)