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


TermInfosReader.h
Go to the documentation of this file.
1 // 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 TERMINFOSREADER_H
8 #define TERMINFOSREADER_H
9 
10 #include "CloseableThreadLocal.h"
11 #include "SimpleLRUCache.h"
12 
13 namespace Lucene {
14 
17 class TermInfosReader : public LuceneObject {
18 public:
19  TermInfosReader(const DirectoryPtr& dir, const String& seg, const FieldInfosPtr& fis, int32_t readBufferSize, int32_t indexDivisor);
20  virtual ~TermInfosReader();
21 
23 
24 protected:
26  String segment;
30  int64_t _size;
31 
35 
37 
38  static const int32_t DEFAULT_CACHE_SIZE;
39 
40 public:
41  int32_t getSkipInterval();
42  int32_t getMaxSkipLevels();
43  void close();
44 
46  int64_t size();
47 
49  TermInfoPtr get(const TermPtr& term);
50 
52  int64_t getPosition(const TermPtr& term);
53 
56 
58  SegmentTermEnumPtr terms(const TermPtr& term);
59 
60 protected:
62 
64  int32_t getIndexOffset(const TermPtr& term);
65 
66  void seekEnum(const SegmentTermEnumPtr& enumerator, int32_t indexOffset);
67 
69  TermInfoPtr get(const TermPtr& term, bool useCache);
70 
71  void ensureIndexIsRead();
72 };
73 
75 public:
77 
79 
80 public:
82 
83  // Used for caching the least recently looked-up Terms
84  TermInfoCachePtr termInfoCache;
85 };
86 
87 }
88 
89 #endif
String segment
Definition: TermInfosReader.h:26
int64_t getPosition(const TermPtr &term)
Returns the position of a Term in the set or -1.
boost::shared_ptr< TermInfosReaderThreadResources > TermInfosReaderThreadResourcesPtr
Definition: LuceneTypes.h:241
int32_t totalIndexInterval
Definition: TermInfosReader.h:36
TermInfosReaderThreadResourcesPtr getThreadResources()
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
CloseableThreadLocal< TermInfosReaderThreadResources > threadResources
Definition: TermInfosReader.h:28
Collection< int64_t > indexPointers
Definition: TermInfosReader.h:34
SegmentTermEnumPtr origEnum
Definition: TermInfosReader.h:29
void seekEnum(const SegmentTermEnumPtr &enumerator, int32_t indexOffset)
int64_t _size
Definition: TermInfosReader.h:30
Collection< TermPtr > indexTerms
Definition: TermInfosReader.h:32
static const int32_t DEFAULT_CACHE_SIZE
Definition: TermInfosReader.h:38
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Base class for all Lucene classes.
Definition: LuceneObject.h:31
int64_t size()
Returns the number of term/value pairs in the set.
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: AbstractAllTermDocs.h:12
int32_t getIndexOffset(const TermPtr &term)
Returns the offset of the greatest index entry which is less than or equal to term.
SegmentTermEnumPtr termEnum
Definition: TermInfosReader.h:78
TermInfoCachePtr termInfoCache
Definition: TermInfosReader.h:84
FieldInfosPtr fieldInfos
Definition: TermInfosReader.h:27
Definition: TermInfosReader.h:74
This stores a monotonically increasing set of pairs in a Directory. Pairs are accessed either by Term or by ordinal position the set.
Definition: TermInfosReader.h:17
Collection< TermInfoPtr > indexInfos
Definition: TermInfosReader.h:33
boost::shared_ptr< TermInfo > TermInfoPtr
Definition: LuceneTypes.h:239
General purpose thread-local map.
Definition: CloseableThreadLocal.h:16
boost::shared_ptr< SegmentTermEnum > SegmentTermEnumPtr
Definition: LuceneTypes.h:218
SegmentTermEnumPtr terms()
Returns an enumeration of all the Terms and TermInfos in the set.
TermInfosReader(const DirectoryPtr &dir, const String &seg, const FieldInfosPtr &fis, int32_t readBufferSize, int32_t indexDivisor)
boost::shared_ptr< FieldInfos > FieldInfosPtr
Definition: LuceneTypes.h:127
DirectoryPtr directory
Definition: TermInfosReader.h:22

clucene.sourceforge.net