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


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

The positionIncrement determines the position of this token relative to the previous Token in a TokenStream, used in phrase searching. More...

#include <PositionIncrementAttribute.h>

+ Inheritance diagram for Lucene::PositionIncrementAttribute:

Public Member Functions

 PositionIncrementAttribute ()
 
virtual ~PositionIncrementAttribute ()
 
virtual String getClassName ()
 
boost::shared_ptr< PositionIncrementAttributeshared_from_this ()
 
virtual String toString ()
 Returns a string representation of the object.
 
virtual void setPositionIncrement (int32_t positionIncrement)
 Set the position increment. The default value is one.
 
virtual int32_t getPositionIncrement ()
 Returns the position increment of this Token.
 
virtual void clear ()
 Clears the values in this Attribute and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.
 
virtual bool equals (const LuceneObjectPtr &other)
 All values used for computation of hashCode() should be checked here for equality.
 
virtual int32_t hashCode ()
 Subclasses must implement this method and should compute a hashCode similar to this:
 
virtual void copyTo (const AttributePtr &target)
 Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Shallow clone. Subclasses must override this if they need to clone any members deeply.
 
- Public Member Functions inherited from Lucene::Attribute
virtual ~Attribute ()
 
boost::shared_ptr< Attributeshared_from_this ()
 
- 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.
 
- 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 Member Functions inherited from Lucene::Attribute
static String _getClassName ()
 

Protected Attributes

int32_t positionIncrement
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Additional Inherited Members

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

Detailed Description

The positionIncrement determines the position of this token relative to the previous Token in a TokenStream, used in phrase searching.

The default value is one.

Some common uses for this are:

Set it to zero to put multiple terms in the same position. This is useful if, eg., a word has multiple stems. Searches for phrases including either stem will match. In this case, all but the first stem's increment should be set to zero: the increment of the first instance should be one. Repeating a token with an increment of zero can also be used to boost the scores of matches on that token.

Set it to values greater than one to inhibit exact phrase matches. If, for example, one does not want phrases to match across removed stop words, then one could build a stop word filter that removes stop words and also sets the increment to the number of stop words removed before each non-stop word. Then exact phrase queries will only match when the terms occur with no intervening stop words.

See also
TermPositions

Constructor & Destructor Documentation

◆ PositionIncrementAttribute()

Lucene::PositionIncrementAttribute::PositionIncrementAttribute ( )

◆ ~PositionIncrementAttribute()

virtual Lucene::PositionIncrementAttribute::~PositionIncrementAttribute ( )
virtual

Member Function Documentation

◆ _getClassName()

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

◆ clear()

virtual void Lucene::PositionIncrementAttribute::clear ( )
virtual

Clears the values in this Attribute and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.

Implements Lucene::Attribute.

◆ clone()

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

Shallow clone. Subclasses must override this if they need to clone any members deeply.

Parameters
baseclone reference - null when called initially, then set in top virtual override.

Implements Lucene::Attribute.

◆ copyTo()

virtual void Lucene::PositionIncrementAttribute::copyTo ( const AttributePtr target)
virtual

Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.

Implements Lucene::Attribute.

◆ equals()

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

All values used for computation of hashCode() should be checked here for equality.

see also LuceneObject#equals(Object)

Implements Lucene::Attribute.

◆ getClassName()

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

Reimplemented from Lucene::Attribute.

◆ getPositionIncrement()

virtual int32_t Lucene::PositionIncrementAttribute::getPositionIncrement ( )
virtual

Returns the position increment of this Token.

See also
setPositionIncrement

◆ hashCode()

virtual int32_t Lucene::PositionIncrementAttribute::hashCode ( )
virtual

Subclasses must implement this method and should compute a hashCode similar to this:

int32_t hashCode() { int32_t code = startOffset; code = code * 31 + endOffset; return code; }

see also equals(Object)

Implements Lucene::Attribute.

◆ setPositionIncrement()

virtual void Lucene::PositionIncrementAttribute::setPositionIncrement ( int32_t  positionIncrement)
virtual

Set the position increment. The default value is one.

Parameters
positionIncrementthe distance from the prior term

◆ shared_from_this()

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

◆ toString()

virtual String Lucene::PositionIncrementAttribute::toString ( )
virtual

Returns a string representation of the object.

Reimplemented from Lucene::LuceneObject.

Field Documentation

◆ positionIncrement

int32_t Lucene::PositionIncrementAttribute::positionIncrement
protected

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

clucene.sourceforge.net