CLucene - a full-featured, c++ search engine
API Documentation
#include <Payload.h>
Public Member Functions | |
Payload () | |
Creates an empty payload and does not allocate a byte array. | |
Payload (uint8_t *_data, const int32_t _dataLen, const int32_t _offset=0, int32_t _length=0) | |
Creates a new payload with the the given array as data. | |
~Payload () | |
void | setData (uint8_t *_data, const int32_t _dataLen) |
Sets this payloads data. | |
void | setData (uint8_t *_data, const int32_t _dataLen, const int32_t _offset, const int32_t _length) |
Sets this payloads data. | |
uint8_t * | getData (int32_t &_dataLen) |
Returns a reference to the underlying byte array that holds this payloads data. | |
int | getOffset () const |
Returns the offset in the underlying byte array. | |
int | getLength () const |
Returns the length of the payload data. | |
uint8_t | byteAt (int index) const |
Returns the byte at the given index. | |
uint8_t * | toByteArray (int32_t &_dataLen) |
Allocates a new byte array, copies the payload data into it and returns it. | |
void | copyTo (uint8_t *target, const int32_t targetLen, const int32_t targetOffset) |
Copies the payload data to a byte array. | |
Payload * | clone () |
Clones this payload by creating a copy of the underlying byte array. | |
Protected Attributes | |
uint8_t * | data |
the byte array containing the payload data | |
int32_t | dataLen |
int32_t | offset |
the offset within the byte array | |
int32_t | length |
the length of the payload data |
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 Tokens containing payload data.
Use TermPositions#getPayloadLength() and TermPositions#getPayload(byte[], int) to retrieve the payloads from the index.
lucene::index::Payload::Payload | ( | ) |
Creates an empty payload and does not allocate a byte array.
lucene::index::Payload::Payload | ( | uint8_t * | _data, | |
const int32_t | _dataLen, | |||
const int32_t | _offset = 0 , |
|||
int32_t | _length = 0 | |||
) |
Creates a new payload with the the given array as data.
A reference to the passed-in array is held, i. e. no copy is made.
_data | the data of this payload | |
_dataLen | the length of _data | |
_offset | the offset in the data byte array | |
_length | the length of the data |
lucene::index::Payload::~Payload | ( | ) |
void lucene::index::Payload::setData | ( | uint8_t * | _data, | |
const int32_t | _dataLen | |||
) |
Sets this payloads data.
A reference to the passed-in array is held, i. e. no copy is made.
void lucene::index::Payload::setData | ( | uint8_t * | _data, | |
const int32_t | _dataLen, | |||
const int32_t | _offset, | |||
const int32_t | _length | |||
) |
Sets this payloads data.
A reference to the passed-in array is held, i. e. no copy is made.
uint8_t* lucene::index::Payload::getData | ( | int32_t & | _dataLen | ) | [inline] |
Returns a reference to the underlying byte array that holds this payloads data.
int lucene::index::Payload::getOffset | ( | ) | const [inline] |
Returns the offset in the underlying byte array.
int lucene::index::Payload::getLength | ( | ) | const [inline] |
Returns the length of the payload data.
uint8_t lucene::index::Payload::byteAt | ( | int | index | ) | const |
Returns the byte at the given index.
uint8_t* lucene::index::Payload::toByteArray | ( | int32_t & | _dataLen | ) |
Allocates a new byte array, copies the payload data into it and returns it.
Caller is responsible for deleting it later.
void lucene::index::Payload::copyTo | ( | uint8_t * | target, | |
const int32_t | targetLen, | |||
const int32_t | targetOffset | |||
) |
Copies the payload data to a byte array.
target | the target byte array | |
targetOffset | the offset in the target byte array |
Payload* lucene::index::Payload::clone | ( | ) |
Clones this payload by creating a copy of the underlying byte array.
uint8_t* lucene::index::Payload::data [protected] |
the byte array containing the payload data
int32_t lucene::index::Payload::dataLen [protected] |
int32_t lucene::index::Payload::offset [protected] |
the offset within the byte array
int32_t lucene::index::Payload::length [protected] |
the length of the payload data