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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
23 
24 protected:
25  SpanNearQueryPtr query;
27 
28  Collection<SpansCellPtr> ordered; // spans in query order
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

clucene.sourceforge.net