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


TermInfosWriter.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 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 public:
18  TermInfosWriter(const DirectoryPtr& directory, const String& segment, const FieldInfosPtr& fis, int32_t interval);
19  TermInfosWriter(const DirectoryPtr& directory, const String& segment, const FieldInfosPtr& fis, int32_t interval, bool isIndex);
20  virtual ~TermInfosWriter();
21 
23 
24 public:
26  static const int32_t FORMAT;
27 
30 
32  static const int32_t FORMAT_CURRENT;
33 
37  int32_t indexInterval;
38 
43  int32_t skipInterval;
44 
47  int32_t maxSkipLevels;
48 
49 protected:
53  int64_t size;
54 
56  bool isIndex;
57  ByteArray lastTermBytes;
59  int32_t lastFieldNumber;
60 
64 
65  // Currently used only by assert statements
68 
69 public:
70  virtual void initialize();
71 
72  void add(const TermPtr& term, const TermInfoPtr& ti);
73 
76  void add(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength, const TermInfoPtr& ti);
77 
79  void close();
80 
81 protected:
82  void initialize(const DirectoryPtr& directory, const String& segment, const FieldInfosPtr& fis, int32_t interval, bool isi);
83 
85  bool initUnicodeResults();
86 
88  int32_t compareToLastTerm(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength);
89 
90  void writeTerm(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength);
91 };
92 
93 }
94 
95 #endif
int64_t lastIndexPointer
Definition: TermInfosWriter.h:55
boost::shared_ptr< UTF8Result > UTF8ResultPtr
Definition: LuceneTypes.h:559
boost::weak_ptr< TermInfosWriter > TermInfosWriterWeakPtr
Definition: LuceneTypes.h:242
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494
void add(const TermPtr &term, const TermInfoPtr &ti)
ByteArray lastTermBytes
Definition: TermInfosWriter.h:57
static const int32_t FORMAT_CURRENT
NOTE: always change this if you switch to a new format.
Definition: TermInfosWriter.h:32
virtual void initialize()
Called directly after instantiation to create objects that depend on this object being fully construc...
int32_t maxSkipLevels
The maximum number of skip levels. Smaller values result in slightly smaller indexes, but slower skipping in big posting lists.
Definition: TermInfosWriter.h:47
int32_t lastTermBytesLength
Definition: TermInfosWriter.h:58
static const int32_t FORMAT_VERSION_UTF8_LENGTH_IN_BYTES
Changed strings to true utf8 with length-in-bytes not length-in-chars.
Definition: TermInfosWriter.h:29
bool isIndex
Definition: TermInfosWriter.h:56
boost::shared_ptr< UnicodeResult > UnicodeResultPtr
Definition: LuceneTypes.h:554
FieldInfosPtr fieldInfos
Definition: TermInfosWriter.h:50
static const int32_t FORMAT
The file format version, a negative number.
Definition: TermInfosWriter.h:22
void writeTerm(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength)
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Base class for all Lucene classes.
Definition: LuceneObject.h:31
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: AbstractAllTermDocs.h:12
int32_t indexInterval
The fraction of terms in the "dictionary" which should be stored in RAM. Smaller values use more memo...
Definition: TermInfosWriter.h:37
IndexOutputPtr output
Definition: TermInfosWriter.h:51
This stores a monotonically increasing set of pairs in a Directory. A TermInfos can be written once, in order.
Definition: TermInfosWriter.h:16
bool initUnicodeResults()
Currently used only by assert statements.
TermInfosWriterWeakPtr _other
Definition: TermInfosWriter.h:62
UnicodeResultPtr unicodeResult2
Definition: TermInfosWriter.h:67
int64_t size
Definition: TermInfosWriter.h:53
void close()
Called to complete TermInfos creation.
boost::shared_ptr< TermInfo > TermInfoPtr
Definition: LuceneTypes.h:239
TermInfosWriter(const DirectoryPtr &directory, const String &segment, const FieldInfosPtr &fis, int32_t interval)
UnicodeResultPtr unicodeResult1
Definition: TermInfosWriter.h:66
int32_t compareToLastTerm(int32_t fieldNumber, ByteArray termBytes, int32_t termBytesLength)
Currently used only by assert statement.
TermInfosWriterPtr otherWriter
Definition: TermInfosWriter.h:61
UTF8ResultPtr utf8Result
Definition: TermInfosWriter.h:63
int32_t lastFieldNumber
Definition: TermInfosWriter.h:59
int32_t skipInterval
The fraction of TermDocs entries stored in skip tables, used to accelerate TermDocs#skipTo(int). Larger values result in smaller indexes, greater acceleration, but fewer accelerable cases, while smaller values result in bigger indexes, less acceleration and more accelerable cases. More detailed experiments would be useful here.
Definition: TermInfosWriter.h:43
TermInfoPtr lastTi
Definition: TermInfosWriter.h:52
boost::shared_ptr< FieldInfos > FieldInfosPtr
Definition: LuceneTypes.h:127
boost::shared_ptr< TermInfosWriter > TermInfosWriterPtr
Definition: LuceneTypes.h:242

clucene.sourceforge.net