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

Loading...
Searching...
No Matches
NearSpansOrdered.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef NEARSPANSORDERED_H
8#define NEARSPANSORDERED_H
9
10#include "Spans.h"
11
12 namespace Lucene {
13
31 class LPPAPI NearSpansOrdered : public Spans {
32 public:
33 NearSpansOrdered(const SpanNearQueryPtr& spanNearQuery, const IndexReaderPtr& reader, bool collectPayloads = true);
34 virtual ~NearSpansOrdered();
35
36 LUCENE_CLASS(NearSpansOrdered);
37
38 protected:
39 int32_t allowedSlop;
40 bool firstTime;
41 bool more;
42
44 Collection<SpansPtr> subSpans;
45
47 bool inSameDoc;
48
49 int32_t matchDoc;
50 int32_t matchStart;
51 int32_t matchEnd;
52 Collection<ByteArray> matchPayload;
53
54 Collection<SpansPtr> subSpansByDoc;
55 SpanNearQueryPtr query;
56 bool collectPayloads;
57
58 public:
59 virtual int32_t doc();
60 virtual int32_t start();
61 virtual int32_t end();
62
63 Collection<SpansPtr> getSubSpans();
64
65 virtual Collection<ByteArray> getPayload();
66 virtual bool isPayloadAvailable();
67 virtual bool next();
68 virtual bool skipTo(int32_t target);
69
73 static bool docSpansOrdered(const SpansPtr& spans1, const SpansPtr& spans2);
74
75 virtual String toString();
76
77 protected:
81 bool advanceAfterOrdered();
82
84 bool toSameDoc();
85
86 // Like {@link #docSpansOrdered(SpansPtr, SpansPtr)}, but use the spans starts and ends as parameters.
87 static bool docSpansOrdered(int32_t start1, int32_t end1, int32_t start2, int32_t end2);
88
90 bool stretchToOrder();
91
94 bool shrinkToAfterShortestMatch();
95};
96
97}
98
99#endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Spans.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::NearSpansOrdered::query
SpanNearQueryPtr query
Definition NearSpansOrdered.h:55
Lucene::NearSpansOrdered::shrinkToAfterShortestMatch
bool shrinkToAfterShortestMatch()
The subSpans are ordered in the same doc, so there is a possible match. Compute the slop while making...
Lucene::NearSpansOrdered::matchPayload
Collection< ByteArray > matchPayload
Definition NearSpansOrdered.h:52
Lucene::NearSpansOrdered::firstTime
bool firstTime
Definition NearSpansOrdered.h:40
Lucene::NearSpansOrdered::matchStart
int32_t matchStart
Definition NearSpansOrdered.h:50
Lucene::NearSpansOrdered::advanceAfterOrdered
bool advanceAfterOrdered()
Advances the subSpans to just after an ordered match with a minimum slop that is smaller than the slo...
Lucene::NearSpansOrdered::NearSpansOrdered
NearSpansOrdered(const SpanNearQueryPtr &spanNearQuery, const IndexReaderPtr &reader, bool collectPayloads=true)
Lucene::NearSpansOrdered::subSpans
Collection< SpansPtr > subSpans
The spans in the same order as the SpanNearQuery.
Definition NearSpansOrdered.h:44
Lucene::NearSpansOrdered::docSpansOrdered
static bool docSpansOrdered(int32_t start1, int32_t end1, int32_t start2, int32_t end2)
Lucene::NearSpansOrdered::toString
virtual String toString()
Returns a string representation of the object.
Lucene::NearSpansOrdered::getPayload
virtual Collection< ByteArray > getPayload()
Returns the payload data for the current span. This is invalid until next() is called for the first t...
Lucene::NearSpansOrdered::inSameDoc
bool inSameDoc
Indicates that all subSpans have same doc().
Definition NearSpansOrdered.h:47
Lucene::NearSpansOrdered::next
virtual bool next()
Move to the next match, returning true if any such exists.
Lucene::NearSpansOrdered::matchDoc
int32_t matchDoc
Definition NearSpansOrdered.h:49
Lucene::NearSpansOrdered::start
virtual int32_t start()
Returns the start position of the current match. Initially invalid.
Lucene::NearSpansOrdered::docSpansOrdered
static bool docSpansOrdered(const SpansPtr &spans1, const SpansPtr &spans2)
Check whether two Spans in the same document are ordered.
Lucene::NearSpansOrdered::~NearSpansOrdered
virtual ~NearSpansOrdered()
Lucene::NearSpansOrdered::doc
virtual int32_t doc()
Returns the document number of the current match. Initially invalid.
Lucene::NearSpansOrdered::more
bool more
Definition NearSpansOrdered.h:41
Lucene::NearSpansOrdered::toSameDoc
bool toSameDoc()
Advance the subSpans to the same document.
Lucene::NearSpansOrdered::subSpansByDoc
Collection< SpansPtr > subSpansByDoc
Definition NearSpansOrdered.h:54
Lucene::NearSpansOrdered::collectPayloads
bool collectPayloads
Definition NearSpansOrdered.h:56
Lucene::NearSpansOrdered::stretchToOrder
bool stretchToOrder()
Order the subSpans within the same document by advancing all later spans after the previous one.
Lucene::NearSpansOrdered::allowedSlop
int32_t allowedSlop
Definition NearSpansOrdered.h:39
Lucene::NearSpansOrdered::matchEnd
int32_t matchEnd
Definition NearSpansOrdered.h:51
Lucene::NearSpansOrdered::isPayloadAvailable
virtual bool isPayloadAvailable()
Checks if a payload can be loaded at this position.
Lucene::NearSpansOrdered::getSubSpans
Collection< SpansPtr > getSubSpans()
Lucene::NearSpansOrdered::skipTo
virtual bool skipTo(int32_t target)
Skips to the first match beyond the current, whose document number is greater than or equal to target...
Lucene::NearSpansOrdered::end
virtual int32_t end()
Returns the end position of the current match. Initially invalid.
Lucene::Spans
An enumeration of span matches. Used to implement span searching. Each span represents a range of ter...
Definition Spans.h:17
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::SpansPtr
boost::shared_ptr< Spans > SpansPtr
Definition LuceneTypes.h:453
Lucene::SpanNearQueryPtr
boost::shared_ptr< SpanNearQuery > SpanNearQueryPtr
Definition LuceneTypes.h:447
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157

clucene.sourceforge.net