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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TermVectorsReader.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 TERMVECTORSREADER_H
8 #define TERMVECTORSREADER_H
9 
10 #include "TermVectorMapper.h"
11 
12 namespace Lucene
13 {
15  {
16  public:
18  TermVectorsReader(DirectoryPtr d, const String& segment, FieldInfosPtr fieldInfos);
19  TermVectorsReader(DirectoryPtr d, const String& segment, FieldInfosPtr fieldInfos,
20  int32_t readBufferSize, int32_t docStoreOffset = -1, int32_t size = 0);
21  virtual ~TermVectorsReader();
22 
24 
25  public:
27  static const int32_t FORMAT_VERSION;
28 
30  static const int32_t FORMAT_VERSION2;
31 
33  static const int32_t FORMAT_UTF8_LENGTH_IN_BYTES;
34 
36  static const int32_t FORMAT_CURRENT;
37 
39  static const int32_t FORMAT_SIZE;
40 
41  static const uint8_t STORE_POSITIONS_WITH_TERMVECTOR;
42  static const uint8_t STORE_OFFSET_WITH_TERMVECTOR;
43 
44  protected:
46 
50  int32_t _size;
51  int32_t numTotalDocs;
52 
54  int32_t docStoreOffset;
55 
56  int32_t format;
57 
58  public:
61 
64 
65  bool canReadRawDocs();
66 
70  void rawDocs(Collection<int32_t> tvdLengths, Collection<int32_t> tvfLengths, int32_t startDocID, int32_t numDocs);
71 
72  void close();
73 
75  int32_t size();
76 
77  void get(int32_t docNum, const String& field, TermVectorMapperPtr mapper);
78 
84  TermFreqVectorPtr get(int32_t docNum, const String& field);
85 
90  Collection<TermFreqVectorPtr> get(int32_t docNum);
91 
92  void get(int32_t docNumber, TermVectorMapperPtr mapper);
93 
95 
96  protected:
97  void ConstructReader(DirectoryPtr d, const String& segment, FieldInfosPtr fieldInfos, int32_t readBufferSize, int32_t docStoreOffset, int32_t size);
98 
99  void seekTvx(int32_t docNum);
100 
101  int32_t checkValidFormat(IndexInputPtr in);
102 
104  Collection<String> readFields(int32_t fieldCount);
105 
107  Collection<int64_t> readTvfPointers(int32_t fieldCount);
108 
111 
115  void readTermVector(const String& field, int64_t tvfPointer, TermVectorMapperPtr mapper);
116  };
117 
120  {
121  public:
124 
126 
127  protected:
135  String field;
136 
137  public:
140  virtual void setExpectations(const String& field, int32_t numTerms, bool storeOffsets, bool storePositions);
141 
143  virtual void map(const String& term, int32_t frequency, Collection<TermVectorOffsetInfoPtr> offsets, Collection<int32_t> positions);
144 
148  };
149 }
150 
151 #endif

clucene.sourceforge.net