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


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

TermPositions provides an interface for enumerating the <document, frequency, <position>*> tuples for a term. The document and frequency are the same as for a TermDocs. The positions portion lists the ordinal positions of each occurrence of a term in a document. More...

#include <TermPositions.h>

+ Inheritance diagram for Lucene::TermPositions:

Public Member Functions

virtual ~TermPositions ()
 
virtual String getClassName ()
 
virtual int32_t nextPosition ()
 Returns next position in the current document. It is an error to call this more than freq() times without calling next(). This is invalid until next() is called for.
 
virtual int32_t getPayloadLength ()
 Returns the length of the payload at the current term position. This is invalid until nextPosition() is called for the first time.
 
virtual ByteArray getPayload (ByteArray data, int32_t offset)
 Returns the payload data at the current term position. This is invalid until nextPosition() is called for the first time. This method must not be called more than once after each call of nextPosition(). However, payloads are loaded lazily, so if the payload data for the current position is not needed, this method may not be called at all for performance reasons.
 
virtual bool isPayloadAvailable ()
 Checks if a payload can be loaded at this position. Payloads can only be loaded once per call to nextPosition().
 
- Public Member Functions inherited from Lucene::TermDocs
virtual void seek (const TermPtr &term)=0
 Sets this to the data for a term. The enumeration is reset to the start of the data for this term.
 
virtual void seek (const TermEnumPtr &termEnum)=0
 Sets this to the data for the current term in a TermEnum. This may be optimized in some implementations.
 
virtual int32_t doc ()=0
 Returns the current document number. This is invalid until next() is called for the first time.
 
virtual int32_t freq ()=0
 Returns the frequency of the term within the current document. This is invalid until next() is called for the first time.
 
virtual bool next ()=0
 Moves to the next pair in the enumeration. Returns true if there is such a next pair in the enumeration.
 
virtual int32_t read (Collection< int32_t > &docs, Collection< int32_t > &freqs)=0
 Attempts to read multiple entries from the enumeration, up to length of docs. Document numbers are stored in docs, and term frequencies are stored in freqs. Returns the number of entries read. Zero is only returned when the stream has been exhausted.
 
virtual bool skipTo (int32_t target)=0
 Skips entries to the first beyond the current whose document number is greater than or equal to target. Returns true if there is such an entry.
 
virtual void close ()=0
 Frees associated resources.
 

Static Public Member Functions

static String _getClassName ()
 
- Static Public Member Functions inherited from Lucene::TermDocs
static String _getClassName ()
 

Protected Member Functions

 TermPositions ()
 
- Protected Member Functions inherited from Lucene::TermDocs
 TermDocs ()
 

Detailed Description

TermPositions provides an interface for enumerating the <document, frequency, <position>*> tuples for a term. The document and frequency are the same as for a TermDocs. The positions portion lists the ordinal positions of each occurrence of a term in a document.

See also
IndexReader::termPositions()

Constructor & Destructor Documentation

◆ TermPositions()

Lucene::TermPositions::TermPositions ( )
protected

◆ ~TermPositions()

virtual Lucene::TermPositions::~TermPositions ( )
virtual

Member Function Documentation

◆ _getClassName()

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

◆ getClassName()

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

◆ getPayload()

virtual ByteArray Lucene::TermPositions::getPayload ( ByteArray  data,
int32_t  offset 
)
virtual

Returns the payload data at the current term position. This is invalid until nextPosition() is called for the first time. This method must not be called more than once after each call of nextPosition(). However, payloads are loaded lazily, so if the payload data for the current position is not needed, this method may not be called at all for performance reasons.

Parameters
datathe array into which the data of this payload is to be stored
offsetthe offset in the array into which the data of this payload is to be stored.
Returns
a byte array containing the data of this payload

Reimplemented in Lucene::MultiTermPositions, Lucene::FilterTermPositions, Lucene::MultipleTermPositions, and Lucene::SegmentTermPositions.

◆ getPayloadLength()

virtual int32_t Lucene::TermPositions::getPayloadLength ( )
virtual

Returns the length of the payload at the current term position. This is invalid until nextPosition() is called for the first time.

Returns
length of the current payload in number of bytes

Reimplemented in Lucene::MultiTermPositions, Lucene::FilterTermPositions, and Lucene::SegmentTermPositions.

◆ isPayloadAvailable()

virtual bool Lucene::TermPositions::isPayloadAvailable ( )
virtual

Checks if a payload can be loaded at this position. Payloads can only be loaded once per call to nextPosition().

Returns
true if there is a payload available at this position that can be loaded

Reimplemented in Lucene::MultiTermPositions, Lucene::FilterTermPositions, Lucene::MultipleTermPositions, and Lucene::SegmentTermPositions.

◆ nextPosition()

virtual int32_t Lucene::TermPositions::nextPosition ( )
virtual

Returns next position in the current document. It is an error to call this more than freq() times without calling next(). This is invalid until next() is called for.

Reimplemented in Lucene::MultiTermPositions, Lucene::FilterTermPositions, Lucene::MultipleTermPositions, and Lucene::SegmentTermPositions.


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

clucene.sourceforge.net