Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TermInfosWriter.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef TERMINFOSWRITER_H
8 #define TERMINFOSWRITER_H
9
10 #include "LuceneObject.h"
11
12 namespace Lucene
13 {
16 class TermInfosWriter : public LuceneObject
17 {
18 public:
19 TermInfosWriter(DirectoryPtr directory, const String& segment, FieldInfosPtr fis, int32_t interval);
20 TermInfosWriter(DirectoryPtr directory, const String& segment, FieldInfosPtr fis, int32_t interval, bool isIndex);
21 virtual ~TermInfosWriter();
22
23 LUCENE_CLASS(TermInfosWriter);
24
25 public:
27 static const int32_t FORMAT;
28
30 static const int32_t FORMAT_VERSION_UTF8_LENGTH_IN_BYTES;
31
33 static const int32_t FORMAT_CURRENT;
34
38 int32_t indexInterval;
39
44 int32_t skipInterval;
45
48 int32_t maxSkipLevels;
49
50 protected:
51 FieldInfosPtr fieldInfos;
52 IndexOutputPtr output;
53 TermInfoPtr lastTi;
54 int64_t size;
55
56 int64_t lastIndexPointer;
57 bool isIndex;
58 ByteArray lastTermBytes;
59 int32_t lastTermBytesLength;
60 int32_t lastFieldNumber;
61
62 TermInfosWriterPtr otherWriter;
63 TermInfosWriterWeakPtr _other;
64 UTF8ResultPtr utf8Result;
65
66 // Currently used only by assert statements
67 UnicodeResultPtr unicodeResult1;
68 UnicodeResultPtr unicodeResult2;
69
70 public:
71 virtual void initialize();
72
73 void add(TermPtr term, TermInfoPtr ti);
74
77 void add(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength, TermInfoPtr ti);
78
80 void close();
81
82 protected:
83 void initialize(DirectoryPtr directory, const String& segment, FieldInfosPtr fis, int32_t interval, bool isi);
84
86 bool initUnicodeResults();
87
89 int32_t compareToLastTerm(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength);
90
91 void writeTerm(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength);
92 };
93 }
94
95 #endif

clucene.sourceforge.net