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


FieldsWriter.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 FIELDSWRITER_H
8 #define FIELDSWRITER_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
14 class FieldsWriter : public LuceneObject {
15 public:
16  FieldsWriter(const DirectoryPtr& d, const String& segment, const FieldInfosPtr& fn);
17  FieldsWriter(const IndexOutputPtr& fdx, const IndexOutputPtr& fdt, const FieldInfosPtr& fn);
18  virtual ~FieldsWriter();
19 
21 
22 protected:
26  bool doClose;
27 
28 public:
29  static const uint8_t FIELD_IS_TOKENIZED;
30  static const uint8_t FIELD_IS_BINARY;
31  static const uint8_t FIELD_IS_COMPRESSED;
32 
33  static const int32_t FORMAT; // Original format
34  static const int32_t FORMAT_VERSION_UTF8_LENGTH_IN_BYTES; // Changed strings to UTF8
35  static const int32_t FORMAT_LUCENE_3_0_NO_COMPRESSED_FIELDS; // Lucene 3.0: Removal of compressed fields
36 
37  // NOTE: if you introduce a new format, make it 1 higher than the current one, and always change this
38  // if you switch to a new format!
39  static const int32_t FORMAT_CURRENT;
40 
41 public:
42  void setFieldsStream(const IndexOutputPtr& stream);
43 
46  void flushDocument(int32_t numStoredFields, const RAMOutputStreamPtr& buffer);
47 
48  void skipDocument();
49  void flush();
50  void close();
51  void writeField(const FieldInfoPtr& fi, const FieldablePtr& field);
52 
55  void addRawDocuments(const IndexInputPtr& stream, Collection<int32_t> lengths, int32_t numDocs);
56 
57  void addDocument(const DocumentPtr& doc);
58 };
59 
60 }
61 
62 #endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::FieldsWriter::addDocument
void addDocument(const DocumentPtr &doc)
Lucene::Collection< int32_t >
Lucene::RAMOutputStreamPtr
boost::shared_ptr< RAMOutputStream > RAMOutputStreamPtr
Definition: LuceneTypes.h:508
Lucene::FieldsWriter::skipDocument
void skipDocument()
Lucene::FieldsWriter::addRawDocuments
void addRawDocuments(const IndexInputPtr &stream, Collection< int32_t > lengths, int32_t numDocs)
Bulk write a contiguous series of documents. The lengths array is the length (in bytes) of each raw d...
Lucene::FieldInfosPtr
boost::shared_ptr< FieldInfos > FieldInfosPtr
Definition: LuceneTypes.h:127
Lucene::FieldsWriter::writeField
void writeField(const FieldInfoPtr &fi, const FieldablePtr &field)
Lucene::FieldsWriter::indexStream
IndexOutputPtr indexStream
Definition: FieldsWriter.h:25
Lucene::DocumentPtr
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::FieldsWriter::FORMAT_VERSION_UTF8_LENGTH_IN_BYTES
static const int32_t FORMAT_VERSION_UTF8_LENGTH_IN_BYTES
Definition: FieldsWriter.h:34
Lucene::FieldInfoPtr
boost::shared_ptr< FieldInfo > FieldInfoPtr
Definition: LuceneTypes.h:126
Lucene::FieldsWriter::close
void close()
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::FieldsWriter::FIELD_IS_TOKENIZED
static const uint8_t FIELD_IS_TOKENIZED
Definition: FieldsWriter.h:29
Lucene::FieldsWriter
Definition: FieldsWriter.h:14
Lucene::FieldsWriter::doClose
bool doClose
Definition: FieldsWriter.h:26
Lucene::IndexInputPtr
boost::shared_ptr< IndexInput > IndexInputPtr
Definition: LuceneTypes.h:493
Lucene::FieldsWriter::FIELD_IS_COMPRESSED
static const uint8_t FIELD_IS_COMPRESSED
Definition: FieldsWriter.h:31
Lucene::FieldsWriter::flushDocument
void flushDocument(int32_t numStoredFields, const RAMOutputStreamPtr &buffer)
Writes the contents of buffer into the fields stream and adds a new entry for this document into the ...
Lucene::FieldsWriter::flush
void flush()
Lucene::FieldablePtr
boost::shared_ptr< Fieldable > FieldablePtr
Definition: LuceneTypes.h:76
Lucene::FieldsWriter::~FieldsWriter
virtual ~FieldsWriter()
Lucene::FieldsWriter::FieldsWriter
FieldsWriter(const DirectoryPtr &d, const String &segment, const FieldInfosPtr &fn)
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Lucene::FieldsWriter::setFieldsStream
void setFieldsStream(const IndexOutputPtr &stream)
Lucene::FieldsWriter::FIELD_IS_BINARY
static const uint8_t FIELD_IS_BINARY
Definition: FieldsWriter.h:30
Lucene::FieldsWriter::fieldInfos
FieldInfosPtr fieldInfos
Definition: FieldsWriter.h:20
Lucene::FieldsWriter::FORMAT_CURRENT
static const int32_t FORMAT_CURRENT
Definition: FieldsWriter.h:39
Lucene::FieldsWriter::FORMAT_LUCENE_3_0_NO_COMPRESSED_FIELDS
static const int32_t FORMAT_LUCENE_3_0_NO_COMPRESSED_FIELDS
Definition: FieldsWriter.h:35
Lucene::FieldsWriter::FORMAT
static const int32_t FORMAT
Definition: FieldsWriter.h:33
Lucene::FieldsWriter::fieldsStream
IndexOutputPtr fieldsStream
Definition: FieldsWriter.h:24
Lucene::IndexOutputPtr
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494
LuceneObject.h

clucene.sourceforge.net