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

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

A Spans that is formed from the ordered subspans of a SpanNearQuery where the subspans do not overlap and have a maximum slop between them. More...

`#include <NearSpansOrdered.h>`

Inheritance diagram for Lucene::NearSpansOrdered:

## Public Member Functions

| NearSpansOrdered (const SpanNearQueryPtr &spanNearQuery, const IndexReaderPtr &reader, bool collectPayloads=true)
virtual | ~NearSpansOrdered ()
virtual String | getClassName ()
boost::shared_ptr< NearSpansOrdered > | shared_from_this ()
virtual int32_t | doc ()
| Returns the document number of the current match. Initially invalid.
virtual int32_t | start ()
| Returns the start position of the current match. Initially invalid.
virtual int32_t | end ()
| Returns the end position of the current match. Initially invalid.
Collection< SpansPtr > | getSubSpans ()
virtual Collection< ByteArray > | getPayload ()

Returns the payload data for the current span. This is invalid until `next()` is called for the first time. This method must not be called more than once after each call of `next()`. However, most 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. An ordered SpanQuery does not lazy load, so if you have payloads in your index and you do not want ordered SpanNearQuerys to collect payloads, you can disable collection with a constructor option.

virtual bool | isPayloadAvailable ()
| Checks if a payload can be loaded at this position.
virtual bool | next ()
| Move to the next match, returning true if any such exists.
virtual bool | skipTo (int32_t target)
| Skips to the first match beyond the current, whose document number is greater than or equal to target.
virtual String | toString ()
| Returns a string representation of the object.
Public Member Functions inherited from Lucene::Spans
virtual | ~Spans ()
boost::shared_ptr< Spans > | shared_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 LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Return clone of this object.
virtual int32_t | hashCode ()
| Return hash code for this object.
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal.
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 bool | docSpansOrdered (const SpansPtr &spans1, const SpansPtr &spans2)
| Check whether two Spans in the same document are ordered.
Static Public Member Functions inherited from Lucene::Spans
static String | _getClassName ()

## Protected Member Functions

bool | advanceAfterOrdered ()
| Advances the subSpans to just after an ordered match with a minimum slop that is smaller than the slop allowed by the SpanNearQuery.
bool | toSameDoc ()
| Advance the subSpans to the same document.
bool | stretchToOrder ()
| Order the subSpans within the same document by advancing all later spans after the previous one.
bool | shrinkToAfterShortestMatch ()
| The subSpans are ordered in the same doc, so there is a possible match. Compute the slop while making the match as short as possible by advancing all subSpans except the last one in reverse order.
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Static Protected Member Functions

static bool | docSpansOrdered (int32_t start1, int32_t end1, int32_t start2, int32_t end2)

## Protected Attributes

int32_t | allowedSlop
bool | firstTime
bool | more
Collection< SpansPtr > | subSpans
| The spans in the same order as the SpanNearQuery.
bool | inSameDoc
| Indicates that all subSpans have same doc().
int32_t | matchDoc
int32_t | matchStart
int32_t | matchEnd
Collection< ByteArray > | matchPayload
Collection< SpansPtr > | subSpansByDoc
SpanNearQueryPtr | query
bool | collectPayloads
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Detailed Description

A Spans that is formed from the ordered subspans of a SpanNearQuery where the subspans do not overlap and have a maximum slop between them.

The formed spans only contains minimum slop matches. The matching slop is computed from the distance(s) between the non overlapping matching Spans.

Successive matches are always formed from the successive Spans of the SpanNearQuery.

The formed spans may contain overlaps when the slop is at least 1. For example, when querying using

    t1 t2 t3

with slop at least 1, the fragment:

    t1 t2 t1 t3 t2 t3

matches twice:

    t1 t2 .. t3

          t1 .. t2 t3

Note: Only public for subclassing. Most implementations should not need this class

## Constructor & Destructor Documentation

## ◆ NearSpansOrdered()

Lucene::NearSpansOrdered::NearSpansOrdered | ( | const SpanNearQueryPtr & | spanNearQuery,
|  | const IndexReaderPtr & | reader,
|  | bool | collectPayloads = true )

References collectPayloads.

Referenced by _getClassName().

## ◆ ~NearSpansOrdered()

virtual Lucene::NearSpansOrdered::~NearSpansOrdered | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

String Lucene::NearSpansOrdered::_getClassName | ( |  | ) |

inline static

References NearSpansOrdered().

## ◆ advanceAfterOrdered()

bool Lucene::NearSpansOrdered::advanceAfterOrdered | ( |  | ) |

protected

Advances the subSpans to just after an ordered match with a minimum slop that is smaller than the slop allowed by the SpanNearQuery.

Returns
  true if there is such a match.

## ◆ doc()

virtual int32_t Lucene::NearSpansOrdered::doc | ( |  | ) |

virtual

Returns the document number of the current match. Initially invalid.

Implements Lucene::Spans.

## ◆ docSpansOrdered() [1/2]

bool Lucene::NearSpansOrdered::docSpansOrdered | ( | const SpansPtr & | spans1,
|  | const SpansPtr & | spans2 )

static

Check whether two Spans in the same document are ordered.

Returns
  true if spans1 starts before spans2 or the spans start at the same position, and spans1 ends before spans2.

## ◆ docSpansOrdered() [2/2]

bool Lucene::NearSpansOrdered::docSpansOrdered | ( | int32_t | start1,
|  | int32_t | end1,
|  | int32_t | start2,
|  | int32_t | end2 )

static protected

## ◆ end()

virtual int32_t Lucene::NearSpansOrdered::end | ( |  | ) |

virtual

Returns the end position of the current match. Initially invalid.

Implements Lucene::Spans.

## ◆ getClassName()

virtual String Lucene::NearSpansOrdered::getClassName | ( |  | ) |

inline virtual

Reimplemented from Lucene::Spans.

## ◆ getPayload()

virtual Collection< ByteArray > Lucene::NearSpansOrdered::getPayload | ( |  | ) |

virtual

Returns the payload data for the current span. This is invalid until `next()` is called for the first time. This method must not be called more than once after each call of `next()`. However, most 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. An ordered SpanQuery does not lazy load, so if you have payloads in your index and you do not want ordered SpanNearQuerys to collect payloads, you can disable collection with a constructor option.

Note that the return type is a collection, thus the ordering should not be relied upon.

Returns
  a List of byte arrays containing the data of this payload, otherwise null if isPayloadAvailable is false

Implements Lucene::Spans.

## ◆ getSubSpans()

Collection< SpansPtr > Lucene::NearSpansOrdered::getSubSpans | ( |  | ) |

## ◆ isPayloadAvailable()

virtual bool Lucene::NearSpansOrdered::isPayloadAvailable | ( |  | ) |

virtual

Checks if a payload can be loaded at this position.

Payloads can only be loaded once per call to `next()`.

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

Implements Lucene::Spans.

## ◆ next()

virtual bool Lucene::NearSpansOrdered::next | ( |  | ) |

virtual

Move to the next match, returning true if any such exists.

Implements Lucene::Spans.

## ◆ shared_from_this()

boost::shared_ptr< NearSpansOrdered > Lucene::NearSpansOrdered::shared_from_this | ( |  | ) |

inline

## ◆ shrinkToAfterShortestMatch()

bool Lucene::NearSpansOrdered::shrinkToAfterShortestMatch | ( |  | ) |

protected

The subSpans are ordered in the same doc, so there is a possible match. Compute the slop while making the match as short as possible by advancing all subSpans except the last one in reverse order.

## ◆ skipTo()

virtual bool Lucene::NearSpansOrdered::skipTo | ( | int32_t | target | ) |

virtual

Skips to the first match beyond the current, whose document number is greater than or equal to target.

Returns true if there is such a match.

Behaves as if written:

    bool skipTo(int32_t target)
    {
        do
        {
            if (!next())
                return false;
        }
        while (target > doc());
        return true;
    }

Most implementations are considerably more efficient than that.

Implements Lucene::Spans.

## ◆ start()

virtual int32_t Lucene::NearSpansOrdered::start | ( |  | ) |

virtual

Returns the start position of the current match. Initially invalid.

Implements Lucene::Spans.

## ◆ stretchToOrder()

bool Lucene::NearSpansOrdered::stretchToOrder | ( |  | ) |

protected

Order the subSpans within the same document by advancing all later spans after the previous one.

## ◆ toSameDoc()

bool Lucene::NearSpansOrdered::toSameDoc | ( |  | ) |

protected

Advance the subSpans to the same document.

## ◆ toString()

virtual String Lucene::NearSpansOrdered::toString | ( |  | ) |

virtual

Returns a string representation of the object.

Reimplemented from Lucene::LuceneObject.

## Field Documentation

## ◆ allowedSlop

int32_t Lucene::NearSpansOrdered::allowedSlop

protected

## ◆ collectPayloads

bool Lucene::NearSpansOrdered::collectPayloads

protected

Referenced by NearSpansOrdered().

## ◆ firstTime

bool Lucene::NearSpansOrdered::firstTime

protected

## ◆ inSameDoc

bool Lucene::NearSpansOrdered::inSameDoc

protected

Indicates that all subSpans have same doc().

## ◆ matchDoc

int32_t Lucene::NearSpansOrdered::matchDoc

protected

## ◆ matchEnd

int32_t Lucene::NearSpansOrdered::matchEnd

protected

## ◆ matchPayload

Collection<ByteArray> Lucene::NearSpansOrdered::matchPayload

protected

## ◆ matchStart

int32_t Lucene::NearSpansOrdered::matchStart

protected

## ◆ more

bool Lucene::NearSpansOrdered::more

protected

## ◆ query

SpanNearQueryPtr Lucene::NearSpansOrdered::query

protected

## ◆ subSpans

Collection<SpansPtr> Lucene::NearSpansOrdered::subSpans

protected

The spans in the same order as the SpanNearQuery.

## ◆ subSpansByDoc

Collection<SpansPtr> Lucene::NearSpansOrdered::subSpansByDoc

protected

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

- NearSpansOrdered.h

clucene.sourceforge.net