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


Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
Lucene::FieldInfos Class Reference

Access to the Fieldable Info file that describes document fields and whether or not they are indexed. Each segment has a separate Fieldable Info file. Objects of this class are thread-safe for multiple readers, but only one thread can be adding documents at a time, with no other reader or writer threads accessing this object. More...

#include <FieldInfos.h>

+ Inheritance diagram for Lucene::FieldInfos:

Public Member Functions

 FieldInfos ()
 
 FieldInfos (const DirectoryPtr &d, const String &name)
 Construct a FieldInfos object using the directory and the name of the file IndexInput.
 
virtual ~FieldInfos ()
 
virtual String getClassName ()
 
boost::shared_ptr< FieldInfosshared_from_this ()
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Returns a deep clone of this FieldInfos instance.
 
void add (const DocumentPtr &doc)
 Adds field info for a Document.
 
bool hasProx ()
 Returns true if any fields do not omitTermFreqAndPositions.
 
void addIndexed (HashSet< String > names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
 Add fields that are indexed. Whether they have termvectors has to be specified.
 
void add (HashSet< String > names, bool isIndexed)
 Assumes the fields are not storing term vectors.
 
void add (const String &name, bool isIndexed)
 Calls 5 parameter add with false for all TermVector parameters.
 
void add (const String &name, bool isIndexed, bool storeTermVector)
 Calls 5 parameter add with false for term vector positions and offsets.
 
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 is the same as was given previously for this field. If not - marks it as being indexed. Same goes for the TermVector parameters.
 
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 is the same as was given previously for this field. If not - marks it as being indexed. Same goes for the TermVector parameters.
 
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 is the same as was given previously for this field. If not - marks it as being indexed. Same goes for the TermVector parameters.
 
int32_t fieldNumber (const String &fieldName)
 
FieldInfoPtr fieldInfo (const String &fieldName)
 
String fieldName (int32_t fieldNumber)
 Return the fieldName identified by its number.
 
FieldInfoPtr fieldInfo (int32_t fieldNumber)
 Return the fieldinfo object referenced by the fieldNumber.
 
int32_t size ()
 
bool hasVectors ()
 
void write (const DirectoryPtr &d, const String &name)
 
void write (const IndexOutputPtr &output)
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
 
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
 
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
 
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
 
virtual void unlock ()
 Unlock this object.
 
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
 
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
 
virtual void notifyAll ()
 Notify all threads waiting for signal.
 

Static Public Member Functions

static String _getClassName ()
 

Static Public Attributes

static const int32_t FORMAT_PRE
 
static const int32_t FORMAT_START
 
static const int32_t CURRENT_FORMAT
 
static const uint8_t IS_INDEXED
 
static const uint8_t STORE_TERMVECTOR
 
static const uint8_t STORE_POSITIONS_WITH_TERMVECTOR
 
static const uint8_t STORE_OFFSET_WITH_TERMVECTOR
 
static const uint8_t OMIT_NORMS
 
static const uint8_t STORE_PAYLOADS
 
static const uint8_t OMIT_TERM_FREQ_AND_POSITIONS
 

Protected Member Functions

FieldInfoPtr addInternal (const String &name, bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions)
 
void read (const IndexInputPtr &input, const String &fileName)
 
- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Protected Attributes

Collection< FieldInfoPtrbyNumber
 
MapStringFieldInfo byName
 
int32_t format
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Detailed Description

Access to the Fieldable Info file that describes document fields and whether or not they are indexed. Each segment has a separate Fieldable Info file. Objects of this class are thread-safe for multiple readers, but only one thread can be adding documents at a time, with no other reader or writer threads accessing this object.

Constructor & Destructor Documentation

◆ FieldInfos() [1/2]

Lucene::FieldInfos::FieldInfos ( )

◆ FieldInfos() [2/2]

Lucene::FieldInfos::FieldInfos ( const DirectoryPtr d,
const String &  name 
)

Construct a FieldInfos object using the directory and the name of the file IndexInput.

Parameters
dThe directory to open the IndexInput from
nameThe name of the file to open the IndexInput from in the Directory

◆ ~FieldInfos()

virtual Lucene::FieldInfos::~FieldInfos ( )
virtual

Member Function Documentation

◆ _getClassName()

static String Lucene::FieldInfos::_getClassName ( )
inlinestatic

◆ add() [1/7]

void Lucene::FieldInfos::add ( const DocumentPtr doc)

Adds field info for a Document.

◆ add() [2/7]

void Lucene::FieldInfos::add ( const String &  name,
bool  isIndexed 
)

Calls 5 parameter add with false for all TermVector parameters.

Parameters
nameThe name of the Fieldable
isIndexedtrue if the field is indexed
See also
add(const String&, bool, bool, bool, bool)

◆ add() [3/7]

void Lucene::FieldInfos::add ( const String &  name,
bool  isIndexed,
bool  storeTermVector 
)

Calls 5 parameter add with false for term vector positions and offsets.

Parameters
nameThe name of the field
isIndexedtrue if the field is indexed
storeTermVectortrue if the term vector should be stored

◆ add() [4/7]

void Lucene::FieldInfos::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 is the same as was given previously for this field. If not - marks it as being indexed. Same goes for the TermVector parameters.

Parameters
nameThe name of the field
isIndexedtrue if the field is indexed
storeTermVectortrue if the term vector should be stored
storePositionWithTermVectortrue if the term vector with positions should be stored
storeOffsetWithTermVectortrue if the term vector with offsets should be stored

◆ add() [5/7]

void Lucene::FieldInfos::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 is the same as was given previously for this field. If not - marks it as being indexed. Same goes for the TermVector parameters.

Parameters
nameThe name of the field
isIndexedtrue if the field is indexed
storeTermVectortrue if the term vector should be stored
storePositionWithTermVectortrue if the term vector with positions should be stored
storeOffsetWithTermVectortrue if the term vector with offsets should be stored
omitNormstrue if the norms for the indexed field should be omitted

◆ add() [6/7]

FieldInfoPtr Lucene::FieldInfos::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 is the same as was given previously for this field. If not - marks it as being indexed. Same goes for the TermVector parameters.

Parameters
nameThe name of the field
isIndexedtrue if the field is indexed
storeTermVectortrue if the term vector should be stored
storePositionWithTermVectortrue if the term vector with positions should be stored
storeOffsetWithTermVectortrue if the term vector with offsets should be stored
omitNormstrue if the norms for the indexed field should be omitted
storePayloadstrue if payloads should be stored for this field
omitTermFreqAndPositionstrue if term freqs should be omitted for this field

◆ add() [7/7]

void Lucene::FieldInfos::add ( HashSet< String >  names,
bool  isIndexed 
)

Assumes the fields are not storing term vectors.

Parameters
namesThe names of the fields
isIndexedWhether the fields are indexed or not
See also
add(const String&, bool)

◆ addIndexed()

void Lucene::FieldInfos::addIndexed ( HashSet< String >  names,
bool  storeTermVectors,
bool  storePositionWithTermVector,
bool  storeOffsetWithTermVector 
)

Add fields that are indexed. Whether they have termvectors has to be specified.

Parameters
namesThe names of the fields
storeTermVectorsWhether the fields store term vectors or not
storePositionWithTermVectortrue if positions should be stored.
storeOffsetWithTermVectortrue if offsets should be stored

◆ addInternal()

FieldInfoPtr Lucene::FieldInfos::addInternal ( const String &  name,
bool  isIndexed,
bool  storeTermVector,
bool  storePositionWithTermVector,
bool  storeOffsetWithTermVector,
bool  omitNorms,
bool  storePayloads,
bool  omitTermFreqAndPositions 
)
protected

◆ clone()

virtual LuceneObjectPtr Lucene::FieldInfos::clone ( const LuceneObjectPtr other = LuceneObjectPtr())
virtual

Returns a deep clone of this FieldInfos instance.

Reimplemented from Lucene::LuceneObject.

◆ fieldInfo() [1/2]

FieldInfoPtr Lucene::FieldInfos::fieldInfo ( const String &  fieldName)

◆ fieldInfo() [2/2]

FieldInfoPtr Lucene::FieldInfos::fieldInfo ( int32_t  fieldNumber)

Return the fieldinfo object referenced by the fieldNumber.

Returns
the FieldInfo object or null when the given fieldNumber doesn't exist.

◆ fieldName()

String Lucene::FieldInfos::fieldName ( int32_t  fieldNumber)

Return the fieldName identified by its number.

Returns
the fieldName or an empty string when the field with the given number doesn't exist.

◆ fieldNumber()

int32_t Lucene::FieldInfos::fieldNumber ( const String &  fieldName)

◆ getClassName()

virtual String Lucene::FieldInfos::getClassName ( )
inlinevirtual

◆ hasProx()

bool Lucene::FieldInfos::hasProx ( )

Returns true if any fields do not omitTermFreqAndPositions.

◆ hasVectors()

bool Lucene::FieldInfos::hasVectors ( )

◆ read()

void Lucene::FieldInfos::read ( const IndexInputPtr input,
const String &  fileName 
)
protected

◆ shared_from_this()

boost::shared_ptr< FieldInfos > Lucene::FieldInfos::shared_from_this ( )
inline

◆ size()

int32_t Lucene::FieldInfos::size ( )

◆ write() [1/2]

void Lucene::FieldInfos::write ( const DirectoryPtr d,
const String &  name 
)

◆ write() [2/2]

void Lucene::FieldInfos::write ( const IndexOutputPtr output)

Field Documentation

◆ byName

MapStringFieldInfo Lucene::FieldInfos::byName
protected

◆ byNumber

Collection<FieldInfoPtr> Lucene::FieldInfos::byNumber
protected

◆ CURRENT_FORMAT

const int32_t Lucene::FieldInfos::CURRENT_FORMAT
static

◆ format

int32_t Lucene::FieldInfos::format
protected

◆ FORMAT_PRE

const int32_t Lucene::FieldInfos::FORMAT_PRE
static

◆ FORMAT_START

const int32_t Lucene::FieldInfos::FORMAT_START
static

◆ IS_INDEXED

const uint8_t Lucene::FieldInfos::IS_INDEXED
static

◆ OMIT_NORMS

const uint8_t Lucene::FieldInfos::OMIT_NORMS
static

◆ OMIT_TERM_FREQ_AND_POSITIONS

const uint8_t Lucene::FieldInfos::OMIT_TERM_FREQ_AND_POSITIONS
static

◆ STORE_OFFSET_WITH_TERMVECTOR

const uint8_t Lucene::FieldInfos::STORE_OFFSET_WITH_TERMVECTOR
static

◆ STORE_PAYLOADS

const uint8_t Lucene::FieldInfos::STORE_PAYLOADS
static

◆ STORE_POSITIONS_WITH_TERMVECTOR

const uint8_t Lucene::FieldInfos::STORE_POSITIONS_WITH_TERMVECTOR
static

◆ STORE_TERMVECTOR

const uint8_t Lucene::FieldInfos::STORE_TERMVECTOR
static

The documentation for this class was generated from the following file:

clucene.sourceforge.net