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 // Copyright (c) 2009-2011 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  {
19  public:
21  virtual ~NearSpansUnordered();
22 
24 
25  protected:
26  SpanNearQueryPtr query;
28 
29  Collection<SpansCellPtr> ordered; // spans in query order
31  int32_t slop; // from query
32 
33  SpansCellPtr first; // linked list of spans
34  SpansCellPtr last; // sorted by doc only
35 
36  int32_t totalLength; // sum of current lengths
37 
38  CellQueuePtr queue; // sorted queue of spans
39  SpansCellPtr max; // max element in queue
40 
41  bool more; // true if not done
42  bool firstTime; // true before first next()
43 
44  public:
45  virtual void initialize();
46 
47  Collection<SpansPtr> getSubSpans();
48 
49  virtual bool next();
50  virtual bool skipTo(int32_t target);
51  virtual int32_t doc();
52  virtual int32_t start();
53  virtual int32_t end();
54  virtual Collection<ByteArray> getPayload();
55  virtual bool isPayloadAvailable();
56  virtual String toString();
57 
58  protected:
59  SpansCellPtr min();
60  void initList(bool next);
61  void addToList(SpansCellPtr cell);
62  void firstToLast();
63  void queueToList();
64  void listToQueue();
65  bool atMatch();
66 
67  friend class SpansCell;
68  };
69 }
70 
71 #endif

clucene.sourceforge.net