vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / index_server / fulltext / CLuceneDataBase.h
blobf62272ad13b0206cdcb72a7b364fe074b4db4cba
1 /*
2 * Copyright 2010, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Clemens Zeidler <haiku@clemens-zeidler.de>
7 */
8 #ifndef CLUCENE_DATA_BASE_H
9 #define CLUCENE_DATA_BASE_H
12 #include <vector>
14 #include <Path.h>
16 #include "TextDataBase.h"
18 #include <CLucene.h>
21 using namespace lucene::index;
22 using namespace lucene::analysis::standard;
25 class CLuceneWriteDataBase : public TextWriteDataBase {
26 public:
27 CLuceneWriteDataBase(const BPath& databasePath);
28 ~CLuceneWriteDataBase();
30 status_t InitCheck();
32 status_t AddDocument(const entry_ref& ref);
33 status_t RemoveDocument(const entry_ref& ref);
34 status_t Commit();
36 private:
37 IndexWriter* _OpenIndexWriter();
38 IndexReader* _OpenIndexReader();
40 bool _RemoveDocuments(std::vector<entry_ref>& docs);
41 bool _RemoveDocument(wchar_t* doc,
42 IndexReader* reader);
44 bool _IndexDocument(const entry_ref& ref);
46 BPath fDataBasePath;
48 BPath fTempPath;
50 std::vector<entry_ref> fAddQueue;
51 std::vector<entry_ref> fDeleteQueue;
53 StandardAnalyzer fStandardAnalyzer;
55 IndexWriter* fIndexWriter;
58 #endif