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


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

A Payload is metadata that can be stored together with each occurrence of a term. This metadata is stored inline in the posting list of the specific term. More...

#include <Payload.h>

+ Inheritance diagram for Lucene::Payload:

Public Member Functions

 Payload ()
 Creates an empty payload and does not allocate a byte array.
 
 Payload (ByteArray data)
 Creates a new payload with the the given array as data. A reference to the passed-in array is held, ie. no copy is made.
 
 Payload (ByteArray data, int32_t offset, int32_t length)
 Creates a new payload with the the given array as data. A reference to the passed-in array is held, ie. no copy is made.
 
virtual ~Payload ()
 
virtual String getClassName ()
 
boost::shared_ptr< Payloadshared_from_this ()
 
void setData (ByteArray data)
 Sets this payloads data. A reference to the passed-in array is held, ie. no copy is made.
 
void setData (ByteArray data, int32_t offset, int32_t length)
 Sets this payloads data. A reference to the passed-in array is held, ie. no copy is made.
 
ByteArray getData ()
 Returns a reference to the underlying byte array that holds this payloads data.
 
int32_t getOffset ()
 Returns the offset in the underlying byte array.
 
int32_t length ()
 Returns the length of the payload data.
 
uint8_t byteAt (int32_t index)
 Returns the byte at the given index.
 
ByteArray toByteArray ()
 Allocates a new byte array, copies the payload data into it and returns it.
 
void copyTo (ByteArray target, int32_t targetOffset)
 Copies the payload data to a byte array.
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Clones this payload by creating a copy of the underlying byte array.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
- 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 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 ()
 

Protected Attributes

ByteArray data
 the byte array containing the payload data
 
int32_t offset
 the offset within the byte array
 
int32_t _length
 the length of the payload data
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Additional Inherited Members

- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Detailed Description

A Payload is metadata that can be stored together with each occurrence of a term. This metadata is stored inline in the posting list of the specific term.

To store payloads in the index a TokenStream has to be used that produces payload data.

Use TermPositions#getPayloadLength() and TermPositions#getPayload(byte[], int) to retrieve the payloads from the index.

Constructor & Destructor Documentation

◆ Payload() [1/3]

Lucene::Payload::Payload ( )

Creates an empty payload and does not allocate a byte array.

◆ Payload() [2/3]

Lucene::Payload::Payload ( ByteArray  data)

Creates a new payload with the the given array as data. A reference to the passed-in array is held, ie. no copy is made.

Parameters
datathe data of this payload

◆ Payload() [3/3]

Lucene::Payload::Payload ( ByteArray  data,
int32_t  offset,
int32_t  length 
)

Creates a new payload with the the given array as data. A reference to the passed-in array is held, ie. no copy is made.

Parameters
datathe data of this payload
offsetthe offset in the data byte array
lengththe length of the data

◆ ~Payload()

virtual Lucene::Payload::~Payload ( )
virtual

Member Function Documentation

◆ _getClassName()

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

◆ byteAt()

uint8_t Lucene::Payload::byteAt ( int32_t  index)

Returns the byte at the given index.

◆ clone()

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

Clones this payload by creating a copy of the underlying byte array.

Reimplemented from Lucene::LuceneObject.

◆ copyTo()

void Lucene::Payload::copyTo ( ByteArray  target,
int32_t  targetOffset 
)

Copies the payload data to a byte array.

Parameters
targetthe target byte array
targetOffsetthe offset in the target byte array

◆ equals()

virtual bool Lucene::Payload::equals ( const LuceneObjectPtr other)
virtual

Return whether two objects are equal.

Reimplemented from Lucene::LuceneObject.

◆ getClassName()

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

◆ getData()

ByteArray Lucene::Payload::getData ( )

Returns a reference to the underlying byte array that holds this payloads data.

◆ getOffset()

int32_t Lucene::Payload::getOffset ( )

Returns the offset in the underlying byte array.

◆ hashCode()

virtual int32_t Lucene::Payload::hashCode ( )
virtual

Return hash code for this object.

Reimplemented from Lucene::LuceneObject.

◆ length()

int32_t Lucene::Payload::length ( )

Returns the length of the payload data.

◆ setData() [1/2]

void Lucene::Payload::setData ( ByteArray  data)

Sets this payloads data. A reference to the passed-in array is held, ie. no copy is made.

◆ setData() [2/2]

void Lucene::Payload::setData ( ByteArray  data,
int32_t  offset,
int32_t  length 
)

Sets this payloads data. A reference to the passed-in array is held, ie. no copy is made.

◆ shared_from_this()

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

◆ toByteArray()

ByteArray Lucene::Payload::toByteArray ( )

Allocates a new byte array, copies the payload data into it and returns it.

Field Documentation

◆ _length

int32_t Lucene::Payload::_length
protected

the length of the payload data

◆ data

ByteArray Lucene::Payload::data
protected

the byte array containing the payload data

◆ offset

int32_t Lucene::Payload::offset
protected

the offset within the byte array


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

clucene.sourceforge.net