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

Field.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 FIELD_H
8 #define FIELD_H
9
10 #include "AbstractField.h"
11
12 namespace Lucene {
13
14 class LPPAPI Field : public AbstractField {
15 public:
23 Field(const String& name, const String& value, Store store, Index index);
24
32 Field(const String& name, const String& value, Store store, Index index, TermVector termVector);
33
40 Field(const String& name, const ReaderPtr& reader);
41
49 Field(const String& name, const ReaderPtr& reader, TermVector termVector);
50
57 Field(const String& name, const TokenStreamPtr& tokenStream);
58
66 Field(const String& name, const TokenStreamPtr& tokenStream, TermVector termVector);
67
73 Field(const String& name, ByteArray value, Store store);
74
82 Field(const String& name, ByteArray value, int32_t offset, int32_t length, Store store);
83
84 virtual ~Field();
85
86 LUCENE_CLASS(Field);
87
88 public:
89 using AbstractField::isStored;
90 using AbstractField::isIndexed;
91
93 static bool isStored(Store store);
94
96 static bool isIndexed(Index index);
97 static bool isAnalyzed(Index index);
98 static bool omitNorms(Index index);
99
101 static Field::Index toIndex(bool indexed, bool analyzed);
102
104 static Field::Index toIndex(bool indexed, bool analyzed, bool omitNorms);
105
107 static bool isStored(TermVector termVector);
108 static bool withPositions(TermVector termVector);
109 static bool withOffsets(TermVector termVector);
110
112 static Field::TermVector toTermVector(bool stored, bool withOffsets, bool withPositions);
113
116 virtual String stringValue();
117
120 virtual ReaderPtr readerValue();
121
124 virtual TokenStreamPtr tokenStreamValue();
125
131 virtual void setValue(const String& value);
132
134 virtual void setValue(const ReaderPtr& value);
135
137 virtual void setValue(ByteArray value);
138
140 virtual void setValue(ByteArray value, int32_t offset, int32_t length);
141
144 virtual void setTokenStream(const TokenStreamPtr& tokenStream);
145
146 protected:
147 void ConstructField(const String& name, const String& value, Store store, Index index, TermVector termVector);
148 void ConstructField(const String& name, const ReaderPtr& reader, TermVector termVector);
149 void ConstructField(const String& name, const TokenStreamPtr& tokenStream, TermVector termVector);
150 void ConstructField(const String& name, ByteArray value, int32_t offset, int32_t length, Store store);
151 };
152
153 }
154
155 #endif
AbstractField.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::AbstractField
Definition: AbstractField.h:14
Lucene::AbstractField::isStored
virtual bool isStored()
True if the value of the field is to be stored in the index for return with search hits....
Lucene::AbstractField::isIndexed
virtual bool isIndexed()
True if the value of the field is to be indexed, so that it may be searched on.
Lucene::AbstractField::Store
Store
Specifies whether and how a field should be stored.
Definition: AbstractField.h:17
Lucene::AbstractField::Index
Index
Specifies whether and how a field should be indexed.
Definition: AbstractField.h:28
Lucene::AbstractField::TermVector
TermVector
Specifies whether and how a field should have term vectors.
Definition: AbstractField.h:57
Lucene::Field
Definition: Field.h:14
Lucene::Field::~Field
virtual ~Field()
Lucene::Field::Field
Field(const String &name, const ReaderPtr &reader)
Create a tokenized and indexed field that is not stored. Term vectors will not be stored....
Lucene::Field::isIndexed
static bool isIndexed(Index index)
Specifies whether and how a field should be indexed.
Lucene::Field::ConstructField
void ConstructField(const String &name, ByteArray value, int32_t offset, int32_t length, Store store)
Lucene::Field::isStored
static bool isStored(TermVector termVector)
Specifies whether and how a field should have term vectors.
Lucene::Field::readerValue
virtual ReaderPtr readerValue()
The value of the field as a Reader, or null. If null, the String value or binary value is used....
Lucene::Field::withOffsets
static bool withOffsets(TermVector termVector)
Lucene::Field::setValue
virtual void setValue(ByteArray value)
Change the value of this field.
Lucene::Field::Field
Field(const String &name, ByteArray value, int32_t offset, int32_t length, Store store)
Create a stored field with binary value. Optionally the value may be compressed.
Lucene::Field::Field
Field(const String &name, const TokenStreamPtr &tokenStream)
Create a tokenized and indexed field that is not stored. Term vectors will not be stored....
Lucene::Field::stringValue
virtual String stringValue()
The value of the field as a String, or null. If null, the Reader value or binary value is used....
Lucene::Field::Field
Field(const String &name, const ReaderPtr &reader, TermVector termVector)
Create a tokenized and indexed field that is not stored, optionally with storing term vectors....
Lucene::Field::Field
Field(const String &name, const String &value, Store store, Index index, TermVector termVector)
Create a field by specifying its name, value and how it will be saved in the index.
Lucene::Field::ConstructField
void ConstructField(const String &name, const String &value, Store store, Index index, TermVector termVector)
Lucene::Field::isStored
static bool isStored(Store store)
Specifies whether and how a field should be stored.
Lucene::Field::tokenStreamValue
virtual TokenStreamPtr tokenStreamValue()
The value of the field as a TokesStream, or null. If null, the Reader value or String value is analyz...
Lucene::Field::setValue
virtual void setValue(const String &value)
Change the value of this field. This can be used during indexing to re-use a single Field instance to...
Lucene::Field::withPositions
static bool withPositions(TermVector termVector)
Lucene::Field::setTokenStream
virtual void setTokenStream(const TokenStreamPtr &tokenStream)
Sets the token stream to be used for indexing and causes isIndexed() and isTokenized() to return true...
Lucene::Field::toIndex
static Field::Index toIndex(bool indexed, bool analyzed, bool omitNorms)
Get the best representation of the index given the flags.
Lucene::Field::toTermVector
static Field::TermVector toTermVector(bool stored, bool withOffsets, bool withPositions)
Get the best representation of the index given the flags.
Lucene::Field::ConstructField
void ConstructField(const String &name, const TokenStreamPtr &tokenStream, TermVector termVector)
Lucene::Field::toIndex
static Field::Index toIndex(bool indexed, bool analyzed)
Get the best representation of the index given the flags.
Lucene::Field::isAnalyzed
static bool isAnalyzed(Index index)
Lucene::Field::ConstructField
void ConstructField(const String &name, const ReaderPtr &reader, TermVector termVector)
Lucene::Field::Field
Field(const String &name, ByteArray value, Store store)
Create a stored field with binary value. Optionally the value may be compressed.
Lucene::Field::Field
Field(const String &name, const String &value, Store store, Index index)
Create a field by specifying its name, value and how it will be saved in the index....
Lucene::Field::Field
Field(const String &name, const TokenStreamPtr &tokenStream, TermVector termVector)
Create a tokenized and indexed field that is not stored, optionally with storing term vectors....
Lucene::Field::setValue
virtual void setValue(ByteArray value, int32_t offset, int32_t length)
Change the value of this field.
Lucene::Field::omitNorms
static bool omitNorms(Index index)
Lucene::Field::setValue
virtual void setValue(const ReaderPtr &value)
Change the value of this field.
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::TokenStreamPtr
boost::shared_ptr< TokenStream > TokenStreamPtr
Definition: LuceneTypes.h:63
Lucene::ReaderPtr
boost::shared_ptr< Reader > ReaderPtr
Definition: LuceneTypes.h:547

clucene.sourceforge.net