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

Loading...
Searching...
No Matches
FieldInfos.h
Go to the documentation of this file.
1
2// 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 FIELDINFOS_H
8#define FIELDINFOS_H
9
10#include "LuceneObject.h"
11
12 namespace Lucene {
13
18 class LPPAPI FieldInfos : public LuceneObject {
19 public:
20 FieldInfos();
21
25 FieldInfos(const DirectoryPtr& d, const String& name);
26
27 virtual ~FieldInfos();
28
29 LUCENE_CLASS(FieldInfos);
30
31 public:
32 // Used internally (ie not written to *.fnm files) for pre-2.9 files
33 static const int32_t FORMAT_PRE;
34
35 // First used in 2.9; prior to 2.9 there was no format header
36 static const int32_t FORMAT_START;
37
38 static const int32_t CURRENT_FORMAT;
39
40 static const uint8_t IS_INDEXED;
41 static const uint8_t STORE_TERMVECTOR;
42 static const uint8_t STORE_POSITIONS_WITH_TERMVECTOR;
43 static const uint8_t STORE_OFFSET_WITH_TERMVECTOR;
44 static const uint8_t OMIT_NORMS;
45 static const uint8_t STORE_PAYLOADS;
46 static const uint8_t OMIT_TERM_FREQ_AND_POSITIONS;
47
48 protected:
49 Collection<FieldInfoPtr> byNumber;
50 MapStringFieldInfo byName;
51 int32_t format;
52
53 public:
55 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
56
58 void add(const DocumentPtr& doc);
59
61 bool hasProx();
62
68 void addIndexed(HashSet<String> names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector);
69
74 void add(HashSet<String> names, bool isIndexed);
75
80 void add(const String& name, bool isIndexed);
81
86 void add(const String& name, bool isIndexed, bool storeTermVector);
87
96 void add(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector);
97
107 void add(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector,
108 bool storeOffsetWithTermVector, bool omitNorms);
109
121 FieldInfoPtr add(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector,
122 bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions);
123
124 int32_t fieldNumber(const String& fieldName);
125 FieldInfoPtr fieldInfo(const String& fieldName);
126
129 String fieldName(int32_t fieldNumber);
130
133 FieldInfoPtr fieldInfo(int32_t fieldNumber);
134
135 int32_t size();
136
137 bool hasVectors();
138
139 void write(const DirectoryPtr& d, const String& name);
140 void write(const IndexOutputPtr& output);
141
142 protected:
143 FieldInfoPtr addInternal(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector,
144 bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions);
145
146 void read(const IndexInputPtr& input, const String& fileName);
147};
148
149}
150
151#endif
LuceneObject.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::FieldInfos::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a deep clone of this FieldInfos instance.
Lucene::FieldInfos::IS_INDEXED
static const uint8_t IS_INDEXED
Definition FieldInfos.h:40
Lucene::FieldInfos::fieldInfo
FieldInfoPtr fieldInfo(int32_t fieldNumber)
Return the fieldinfo object referenced by the fieldNumber.
Lucene::FieldInfos::STORE_OFFSET_WITH_TERMVECTOR
static const uint8_t STORE_OFFSET_WITH_TERMVECTOR
Definition FieldInfos.h:43
Lucene::FieldInfos::STORE_PAYLOADS
static const uint8_t STORE_PAYLOADS
Definition FieldInfos.h:45
Lucene::FieldInfos::addIndexed
void addIndexed(HashSet< String > names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
Add fields that are indexed. Whether they have termvectors has to be specified.
Lucene::FieldInfos::add
void add(const DocumentPtr &doc)
Adds field info for a Document.
Lucene::FieldInfos::add
void add(const String &name, bool isIndexed, bool storeTermVector)
Calls 5 parameter add with false for term vector positions and offsets.
Lucene::FieldInfos::fieldName
String fieldName(int32_t fieldNumber)
Return the fieldName identified by its number.
Lucene::FieldInfos::addInternal
FieldInfoPtr addInternal(const String &name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions)
Lucene::FieldInfos::STORE_POSITIONS_WITH_TERMVECTOR
static const uint8_t STORE_POSITIONS_WITH_TERMVECTOR
Definition FieldInfos.h:42
Lucene::FieldInfos::fieldNumber
int32_t fieldNumber(const String &fieldName)
Lucene::FieldInfos::size
int32_t size()
Lucene::FieldInfos::OMIT_TERM_FREQ_AND_POSITIONS
static const uint8_t OMIT_TERM_FREQ_AND_POSITIONS
Definition FieldInfos.h:46
Lucene::FieldInfos::add
void add(HashSet< String > names, bool isIndexed)
Assumes the fields are not storing term vectors.
Lucene::FieldInfos::add
FieldInfoPtr add(const String &name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions)
If the field is not yet known, adds it. If it is known, checks to make sure that the isIndexed flag i...
Lucene::FieldInfos::fieldInfo
FieldInfoPtr fieldInfo(const String &fieldName)
Lucene::FieldInfos::add
void add(const String &name, bool isIndexed)
Calls 5 parameter add with false for all TermVector parameters.
Lucene::FieldInfos::byName
MapStringFieldInfo byName
Definition FieldInfos.h:50
Lucene::FieldInfos::hasVectors
bool hasVectors()
Lucene::FieldInfos::FORMAT_START
static const int32_t FORMAT_START
Definition FieldInfos.h:36
Lucene::FieldInfos::OMIT_NORMS
static const uint8_t OMIT_NORMS
Definition FieldInfos.h:44
Lucene::FieldInfos::add
void add(const String &name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool omitNorms)
If the field is not yet known, adds it. If it is known, checks to make sure that the isIndexed flag i...
Lucene::FieldInfos::hasProx
bool hasProx()
Returns true if any fields do not omitTermFreqAndPositions.
Lucene::FieldInfos::format
int32_t format
Definition FieldInfos.h:51
Lucene::FieldInfos::write
void write(const IndexOutputPtr &output)
Lucene::FieldInfos::FieldInfos
FieldInfos(const DirectoryPtr &d, const String &name)
Construct a FieldInfos object using the directory and the name of the file IndexInput.
Lucene::FieldInfos::~FieldInfos
virtual ~FieldInfos()
Lucene::FieldInfos::byNumber
Collection< FieldInfoPtr > byNumber
Definition FieldInfos.h:49
Lucene::FieldInfos::STORE_TERMVECTOR
static const uint8_t STORE_TERMVECTOR
Definition FieldInfos.h:41
Lucene::FieldInfos::FORMAT_PRE
static const int32_t FORMAT_PRE
Definition FieldInfos.h:33
Lucene::FieldInfos::add
void add(const String &name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
If the field is not yet known, adds it. If it is known, checks to make sure that the isIndexed flag i...
Lucene::FieldInfos::write
void write(const DirectoryPtr &d, const String &name)
Lucene::FieldInfos::FieldInfos
FieldInfos()
Lucene::FieldInfos::CURRENT_FORMAT
static const int32_t CURRENT_FORMAT
Definition FieldInfos.h:38
Lucene::FieldInfos::read
void read(const IndexInputPtr &input, const String &fileName)
Lucene::HashSet
Utility template class to handle hash set collections that can be safely copied and shared.
Definition HashSet.h:17
Lucene::LuceneObject::LuceneObject
LuceneObject()
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::IndexInputPtr
boost::shared_ptr< IndexInput > IndexInputPtr
Definition LuceneTypes.h:493
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition LuceneTypes.h:489
Lucene::IndexOutputPtr
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition LuceneTypes.h:494
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
Lucene::FieldInfoPtr
boost::shared_ptr< FieldInfo > FieldInfoPtr
Definition LuceneTypes.h:126
Lucene::DocumentPtr
boost::shared_ptr< Document > DocumentPtr
Definition LuceneTypes.h:74

clucene.sourceforge.net