From 86795bae5b3fffa1b457bc7c62a24ac8f2ecb7ac Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Fri, 29 Oct 2010 07:53:22 +0000 Subject: [PATCH] Check if entries are already in the clucene index/remove queue. This fix duplivated entries in the database. Don't check if delete files are text files because this will probably fail. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39181 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../index_server/FullText/CLuceneDataBase.cpp | 14 ++++++++++++-- .../index_server/FullText/FullTextAnalyser.cpp | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/add-ons/index_server/FullText/CLuceneDataBase.cpp b/src/add-ons/index_server/FullText/CLuceneDataBase.cpp index a6147d644b..986259549f 100644 --- a/src/add-ons/index_server/FullText/CLuceneDataBase.cpp +++ b/src/add-ons/index_server/FullText/CLuceneDataBase.cpp @@ -72,17 +72,27 @@ CLuceneWriteDataBase::InitCheck() status_t CLuceneWriteDataBase::AddDocument(const entry_ref& ref) { + // check if already in the queue + for (unsigned int i = 0; i < fAddQueue.size(); i++) { + if (fAddQueue.at(i) == ref) + return B_OK; + } fAddQueue.push_back(ref); - return B_ERROR; + return B_OK; } status_t CLuceneWriteDataBase::RemoveDocument(const entry_ref& ref) { + // check if already in the queue + for (unsigned int i = 0; i < fAddQueue.size(); i++) { + if (fDeleteQueue.at(i) == ref) + return B_OK; + } fDeleteQueue.push_back(ref); - return B_ERROR; + return B_OK; } diff --git a/src/add-ons/index_server/FullText/FullTextAnalyser.cpp b/src/add-ons/index_server/FullText/FullTextAnalyser.cpp index 2d9a5439af..e1e9c23796 100644 --- a/src/add-ons/index_server/FullText/FullTextAnalyser.cpp +++ b/src/add-ons/index_server/FullText/FullTextAnalyser.cpp @@ -81,7 +81,7 @@ FullTextAnalyser::AnalyseEntry(const entry_ref& ref) void FullTextAnalyser::DeleteEntry(const entry_ref& ref) { - if (!_InterestingEntry(ref)) + if (_IsInIndexDirectory(ref)) return; STRACE("FullTextAnalyser DeleteEntry: %s\n", ref.name); fWriteDataBase->RemoveDocument(ref);