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
FieldInfos.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 FIELDINFOS_H
8 #define FIELDINFOS_H
9
10 #include "LuceneObject.h"
11
12 namespace Lucene
13 {
18 class FieldInfos : public LuceneObject
19 {
20 public:
21 FieldInfos();
22
26 FieldInfos(DirectoryPtr d, const String& name);
27
28 virtual ~FieldInfos();
29
30 LUCENE_CLASS(FieldInfos);
31
32 public:
33 // Used internally (ie not written to *.fnm files) for pre-2.9 files
34 static const int32_t FORMAT_PRE;
35
36 // First used in 2.9; prior to 2.9 there was no format header
37 static const int32_t FORMAT_START;
38
39 static const int32_t CURRENT_FORMAT;
40
41 static const uint8_t IS_INDEXED;
42 static const uint8_t STORE_TERMVECTOR;
43 static const uint8_t STORE_POSITIONS_WITH_TERMVECTOR;
44 static const uint8_t STORE_OFFSET_WITH_TERMVECTOR;
45 static const uint8_t OMIT_NORMS;
46 static const uint8_t STORE_PAYLOADS;
47 static const uint8_t OMIT_TERM_FREQ_AND_POSITIONS;
48
49 protected:
50 Collection<FieldInfoPtr> byNumber;
51 MapStringFieldInfo byName;
52 int32_t format;
53
54 public:
56 virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
57
59 void add(DocumentPtr doc);
60
62 bool hasProx();
63
69 void addIndexed(HashSet<String> names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector);
70
75 void add(HashSet<String> names, bool isIndexed);
76
81 void add(const String& name, bool isIndexed);
82
87 void add(const String& name, bool isIndexed, bool storeTermVector);
88
97 void add(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector);
98
108 void add(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector,
109 bool storeOffsetWithTermVector, bool omitNorms);
110
122 FieldInfoPtr add(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector,
123 bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions);
124
125 int32_t fieldNumber(const String& fieldName);
126 FieldInfoPtr fieldInfo(const String& fieldName);
127
130 String fieldName(int32_t fieldNumber);
131
134 FieldInfoPtr fieldInfo(int32_t fieldNumber);
135
136 int32_t size();
137
138 bool hasVectors();
139
140 void write(DirectoryPtr d, const String& name);
141 void write(IndexOutputPtr output);
142
143 protected:
144 FieldInfoPtr addInternal(const String& name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector,
145 bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions);
146
147 void read(IndexInputPtr input, const String& fileName);
148 };
149 }
150
151 #endif

clucene.sourceforge.net