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

Loading...
Searching...
No Matches
NearSpansUnordered.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 NEARSPANSUNORDERED_H
8#define NEARSPANSUNORDERED_H
9
10#include "Spans.h"
11
12 namespace Lucene {
13
17 class LPPAPI NearSpansUnordered : public Spans {
18 public:
19 NearSpansUnordered(const SpanNearQueryPtr& query, const IndexReaderPtr& reader);
20 virtual ~NearSpansUnordered();
21
22 LUCENE_CLASS(NearSpansUnordered);
23
24 protected:
25 SpanNearQueryPtr query;
26 IndexReaderPtr reader;
27
28 Collection<SpansCellPtr> ordered; // spans in query order
29 Collection<SpansPtr> subSpans;
30 int32_t slop; // from query
31
32 SpansCellPtr first; // linked list of spans
33 SpansCellPtr last; // sorted by doc only
34
35 int32_t totalLength; // sum of current lengths
36
37 CellQueuePtr queue; // sorted queue of spans
38 SpansCellPtr max; // max element in queue
39
40 bool more; // true if not done
41 bool firstTime; // true before first next()
42
43 public:
44 virtual void initialize();
45
46 Collection<SpansPtr> getSubSpans();
47
48 virtual bool next();
49 virtual bool skipTo(int32_t target);
50 virtual int32_t doc();
51 virtual int32_t start();
52 virtual int32_t end();
53 virtual Collection<ByteArray> getPayload();
54 virtual bool isPayloadAvailable();
55 virtual String toString();
56
57 protected:
58 SpansCellPtr min();
59 void initList(bool next);
60 void addToList(const SpansCellPtr& cell);
61 void firstToLast();
62 void queueToList();
63 void listToQueue();
64 bool atMatch();
65
66 friend class SpansCell;
67};
68
69}
70
71#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::NearSpansUnordered
Similar to NearSpansOrdered, but for the unordered case.
Definition NearSpansUnordered.h:17
Lucene::NearSpansUnordered::listToQueue
void listToQueue()
Lucene::NearSpansUnordered::ordered
Collection< SpansCellPtr > ordered
Definition NearSpansUnordered.h:28
Lucene::NearSpansUnordered::queueToList
void queueToList()
Lucene::NearSpansUnordered::getSubSpans
Collection< SpansPtr > getSubSpans()
Lucene::NearSpansUnordered::atMatch
bool atMatch()
Lucene::NearSpansUnordered::min
SpansCellPtr min()
Lucene::NearSpansUnordered::last
SpansCellPtr last
Definition NearSpansUnordered.h:33
Lucene::NearSpansUnordered::doc
virtual int32_t doc()
Returns the document number of the current match. Initially invalid.
Lucene::NearSpansUnordered::queue
CellQueuePtr queue
Definition NearSpansUnordered.h:37
Lucene::NearSpansUnordered::slop
int32_t slop
Definition NearSpansUnordered.h:30
Lucene::NearSpansUnordered::toString
virtual String toString()
Returns a string representation of the object.
Lucene::NearSpansUnordered::reader
IndexReaderPtr reader
Definition NearSpansUnordered.h:26
Lucene::NearSpansUnordered::max
SpansCellPtr max
Definition NearSpansUnordered.h:38
Lucene::NearSpansUnordered::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::NearSpansUnordered::addToList
void addToList(const SpansCellPtr &cell)
Lucene::NearSpansUnordered::initialize
virtual void initialize()
Called directly after instantiation to create objects that depend on this object being fully construc...
Lucene::NearSpansUnordered::next
virtual bool next()
Move to the next match, returning true if any such exists.
Lucene::NearSpansUnordered::first
SpansCellPtr first
Definition NearSpansUnordered.h:32
Lucene::NearSpansUnordered::end
virtual int32_t end()
Returns the end position of the current match. Initially invalid.
Lucene::NearSpansUnordered::totalLength
int32_t totalLength
Definition NearSpansUnordered.h:35
Lucene::NearSpansUnordered::more
bool more
Definition NearSpansUnordered.h:40
Lucene::NearSpansUnordered::firstToLast
void firstToLast()
Lucene::NearSpansUnordered::~NearSpansUnordered
virtual ~NearSpansUnordered()
Lucene::NearSpansUnordered::NearSpansUnordered
NearSpansUnordered(const SpanNearQueryPtr &query, const IndexReaderPtr &reader)
Lucene::NearSpansUnordered::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::NearSpansUnordered::firstTime
bool firstTime
Definition NearSpansUnordered.h:41
Lucene::NearSpansUnordered::start
virtual int32_t start()
Returns the start position of the current match. Initially invalid.
Lucene::NearSpansUnordered::subSpans
Collection< SpansPtr > subSpans
Definition NearSpansUnordered.h:29
Lucene::NearSpansUnordered::isPayloadAvailable
virtual bool isPayloadAvailable()
Checks if a payload can be loaded at this position.
Lucene::NearSpansUnordered::query
SpanNearQueryPtr query
Definition NearSpansUnordered.h:25
Lucene::NearSpansUnordered::initList
void initList(bool next)
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::SpansCellPtr
boost::shared_ptr< SpansCell > SpansCellPtr
Definition LuceneTypes.h:454
Lucene::CellQueuePtr
boost::shared_ptr< CellQueue > CellQueuePtr
Definition LuceneTypes.h:294
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157
Lucene::SpanNearQueryPtr
boost::shared_ptr< SpanNearQuery > SpanNearQueryPtr
Definition LuceneTypes.h:447

clucene.sourceforge.net