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

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

## 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< FieldInfoPtr > | byNumber
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

  d | The directory to open the IndexInput from
  name | The 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 | ( |  | ) |

inline static

## ◆ add() [1/7]

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

Adds field info for a Document.

## ◆ add() [2/7]

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

Assumes the fields are not storing term vectors.

Parameters

  names | The names of the fields
  isIndexed | Whether the fields are indexed or not

See also
  add(const String&, bool)

## ◆ add() [3/7]

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

Calls 5 parameter add with false for all TermVector parameters.

Parameters

  name | The name of the Fieldable
  isIndexed | true if the field is indexed

See also
  add(const String&, bool, bool, bool, bool)

## ◆ add() [4/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

  name | The name of the field
  isIndexed | true if the field is indexed
  storeTermVector | true if the term vector should be stored

## ◆ add() [5/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

  name | The name of the field
  isIndexed | true if the field is indexed
  storeTermVector | true if the term vector should be stored
  storePositionWithTermVector | true if the term vector with positions should be stored
  storeOffsetWithTermVector | true if the term vector with offsets should be stored

## ◆ add() [6/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

  name | The name of the field
  isIndexed | true if the field is indexed
  storeTermVector | true if the term vector should be stored
  storePositionWithTermVector | true if the term vector with positions should be stored
  storeOffsetWithTermVector | true if the term vector with offsets should be stored
  omitNorms | true if the norms for the indexed field should be omitted

## ◆ add() [7/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

  name | The name of the field
  isIndexed | true if the field is indexed
  storeTermVector | true if the term vector should be stored
  storePositionWithTermVector | true if the term vector with positions should be stored
  storeOffsetWithTermVector | true if the term vector with offsets should be stored
  omitNorms | true if the norms for the indexed field should be omitted
  storePayloads | true if payloads should be stored for this field
  omitTermFreqAndPositions | true if term freqs should be omitted for this field

## ◆ 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

  names | The names of the fields
  storeTermVectors | Whether the fields store term vectors or not
  storePositionWithTermVector | true if positions should be stored.
  storeOffsetWithTermVector | true 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 | ( |  | ) |

inline virtual

## ◆ 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:

- FieldInfos.h

clucene.sourceforge.net