1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QCLucene library and is distributable under
|
---|
7 | ** the terms of the LGPL license as specified in the license.txt file.
|
---|
8 | **
|
---|
9 | ****************************************************************************/
|
---|
10 |
|
---|
11 | #ifndef QINDEXWRITER_P_H
|
---|
12 | #define QINDEXWRITER_P_H
|
---|
13 |
|
---|
14 | //
|
---|
15 | // W A R N I N G
|
---|
16 | // -------------
|
---|
17 | //
|
---|
18 | // This file is not part of the Qt API. It exists for the convenience
|
---|
19 | // of the help generator tools. This header file may change from version
|
---|
20 | // to version without notice, or even be removed.
|
---|
21 | //
|
---|
22 | // We mean it.
|
---|
23 | //
|
---|
24 |
|
---|
25 | #include "qanalyzer_p.h"
|
---|
26 | #include "qdocument_p.h"
|
---|
27 | #include "qclucene_global_p.h"
|
---|
28 |
|
---|
29 | #include <QtCore/QString>
|
---|
30 | #include <QtCore/QSharedDataPointer>
|
---|
31 | #include <QtCore/QSharedData>
|
---|
32 |
|
---|
33 | CL_NS_DEF(index)
|
---|
34 | class IndexWriter;
|
---|
35 | CL_NS_END
|
---|
36 | CL_NS_USE(index)
|
---|
37 |
|
---|
38 | QT_BEGIN_NAMESPACE
|
---|
39 |
|
---|
40 | class QCLuceneIndexReader;
|
---|
41 |
|
---|
42 | class QHELP_EXPORT QCLuceneIndexWriterPrivate : public QSharedData
|
---|
43 | {
|
---|
44 | public:
|
---|
45 | QCLuceneIndexWriterPrivate();
|
---|
46 | QCLuceneIndexWriterPrivate(const QCLuceneIndexWriterPrivate &other);
|
---|
47 |
|
---|
48 | ~QCLuceneIndexWriterPrivate();
|
---|
49 |
|
---|
50 | IndexWriter *writer;
|
---|
51 | bool deleteCLuceneIndexWriter;
|
---|
52 |
|
---|
53 | private:
|
---|
54 | QCLuceneIndexWriterPrivate &operator=(const QCLuceneIndexWriterPrivate &other);
|
---|
55 | };
|
---|
56 |
|
---|
57 | class QHELP_EXPORT QCLuceneIndexWriter
|
---|
58 | {
|
---|
59 | public:
|
---|
60 | enum {
|
---|
61 | DEFAULT_MERGE_FACTOR = 10,
|
---|
62 | COMMIT_LOCK_TIMEOUT = 10000,
|
---|
63 | DEFAULT_MAX_BUFFERED_DOCS = 10,
|
---|
64 | DEFAULT_MAX_FIELD_LENGTH = 10000,
|
---|
65 | DEFAULT_TERM_INDEX_INTERVAL = 128,
|
---|
66 | DEFAULT_MAX_MERGE_DOCS = 0x7FFFFFFFL
|
---|
67 | };
|
---|
68 |
|
---|
69 | QCLuceneIndexWriter(const QString &path, QCLuceneAnalyzer &analyzer,
|
---|
70 | bool create, bool closeDir = true);
|
---|
71 | virtual ~QCLuceneIndexWriter();
|
---|
72 |
|
---|
73 | void close();
|
---|
74 | void optimize();
|
---|
75 | qint32 docCount();
|
---|
76 | QCLuceneAnalyzer getAnalyzer();
|
---|
77 |
|
---|
78 | void addIndexes(const QList<QCLuceneIndexReader*> &readers);
|
---|
79 | void addDocument(QCLuceneDocument &doc, QCLuceneAnalyzer &analyzer);
|
---|
80 |
|
---|
81 | qint32 getMaxFieldLength() const;
|
---|
82 | void setMaxFieldLength(qint32 value);
|
---|
83 |
|
---|
84 | qint32 getMaxBufferedDocs() const;
|
---|
85 | void setMaxBufferedDocs(qint32 value);
|
---|
86 |
|
---|
87 | qint64 getWriteLockTimeout() const;
|
---|
88 | void setWriteLockTimeout(qint64 writeLockTimeout);
|
---|
89 |
|
---|
90 | qint64 getCommitLockTimeout() const;
|
---|
91 | void setCommitLockTimeout(qint64 commitLockTimeout);
|
---|
92 |
|
---|
93 | qint32 getMergeFactor() const;
|
---|
94 | void setMergeFactor(qint32 value);
|
---|
95 |
|
---|
96 | qint32 getTermIndexInterval() const;
|
---|
97 | void setTermIndexInterval(qint32 interval);
|
---|
98 |
|
---|
99 | qint32 getMinMergeDocs() const;
|
---|
100 | void setMinMergeDocs(qint32 value);
|
---|
101 |
|
---|
102 | qint32 getMaxMergeDocs() const;
|
---|
103 | void setMaxMergeDocs(qint32 value);
|
---|
104 |
|
---|
105 | bool getUseCompoundFile() const;
|
---|
106 | void setUseCompoundFile(bool value);
|
---|
107 |
|
---|
108 | protected:
|
---|
109 | QSharedDataPointer<QCLuceneIndexWriterPrivate> d;
|
---|
110 |
|
---|
111 | private:
|
---|
112 | QCLuceneAnalyzer analyzer;
|
---|
113 | };
|
---|
114 |
|
---|
115 | QT_END_NAMESPACE
|
---|
116 |
|
---|
117 | #endif // QINDEXWRITER_P_H
|
---|