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
22 LUCENE_CLASS(TermInfosReader);
23
24 protected:
25 DirectoryPtr directory;
26 String segment;
27 FieldInfosPtr fieldInfos;
28 CloseableThreadLocal<TermInfosReaderThreadResources> threadResources;
29 SegmentTermEnumPtr origEnum;
30 int64_t _size;
31
32 Collection<TermPtr> indexTerms;
33 Collection<TermInfoPtr> indexInfos;
34 Collection<int64_t> indexPointers;
35
36 int32_t totalIndexInterval;
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
55 SegmentTermEnumPtr terms();
56
58 SegmentTermEnumPtr terms(const TermPtr& term);
59
60 protected:
61 TermInfosReaderThreadResourcesPtr getThreadResources();
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
74 class TermInfosReaderThreadResources : public LuceneObject {
75 public:
76 virtual ~TermInfosReaderThreadResources();
77
78 LUCENE_CLASS(TermInfosReaderThreadResources);
79
80 public:
81 SegmentTermEnumPtr termEnum;
82
83 // Used for caching the least recently looked-up Terms
84 TermInfoCachePtr termInfoCache;
85 };
86
87 }
88
89 #endif
Lucene::TermInfosReader::segment
String segment
Definition: TermInfosReader.h:26
Lucene::TermInfosReader::getPosition
int64_t getPosition(const TermPtr &term)
Returns the position of a Term in the set or -1.
Lucene::TermInfosReaderThreadResourcesPtr
boost::shared_ptr< TermInfosReaderThreadResources > TermInfosReaderThreadResourcesPtr
Definition: LuceneTypes.h:241
Lucene::TermInfosReader::totalIndexInterval
int32_t totalIndexInterval
Definition: TermInfosReader.h:36
Lucene::TermInfosReader::getThreadResources
TermInfosReaderThreadResourcesPtr getThreadResources()
Lucene::TermPtr
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
Lucene::TermInfosReader::getMaxSkipLevels
int32_t getMaxSkipLevels()
Lucene::TermInfosReader::threadResources
CloseableThreadLocal< TermInfosReaderThreadResources > threadResources
Definition: TermInfosReader.h:28
Lucene::TermInfosReader::ensureIndexIsRead
void ensureIndexIsRead()
Lucene::TermInfosReader::indexPointers
Collection< int64_t > indexPointers
Definition: TermInfosReader.h:34
CloseableThreadLocal.h
Lucene::TermInfosReader::getSkipInterval
int32_t getSkipInterval()
Lucene::TermInfosReader::origEnum
SegmentTermEnumPtr origEnum
Definition: TermInfosReader.h:29
Lucene::TermInfosReader::seekEnum
void seekEnum(const SegmentTermEnumPtr &enumerator, int32_t indexOffset)
Lucene::TermInfosReader::_size
int64_t _size
Definition: TermInfosReader.h:30
Lucene::TermInfosReader::close
void close()
Lucene::TermInfosReader::indexTerms
Collection< TermPtr > indexTerms
Definition: TermInfosReader.h:32
Lucene::TermInfosReader::DEFAULT_CACHE_SIZE
static const int32_t DEFAULT_CACHE_SIZE
Definition: TermInfosReader.h:38
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::TermInfosReader::size
int64_t size()
Returns the number of term/value pairs in the set.
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::TermInfosReader::getIndexOffset
int32_t getIndexOffset(const TermPtr &term)
Returns the offset of the greatest index entry which is less than or equal to term.
Lucene::TermInfosReaderThreadResources::termEnum
SegmentTermEnumPtr termEnum
Definition: TermInfosReader.h:78
Lucene::TermInfosReaderThreadResources::termInfoCache
TermInfoCachePtr termInfoCache
Definition: TermInfosReader.h:84
Lucene::TermInfosReader::fieldInfos
FieldInfosPtr fieldInfos
Definition: TermInfosReader.h:27
Lucene::TermInfosReaderThreadResources
Definition: TermInfosReader.h:74
Lucene::Collection< TermPtr >
Lucene::TermInfosReader
This stores a monotonically increasing set of <Term, TermInfo> pairs in a Directory. Pairs are accessed either by Term or by ordinal position the set.
Definition: TermInfosReader.h:17
Lucene::TermInfosReader::indexInfos
Collection< TermInfoPtr > indexInfos
Definition: TermInfosReader.h:33
Lucene::TermInfoPtr
boost::shared_ptr< TermInfo > TermInfoPtr
Definition: LuceneTypes.h:239
Lucene::CloseableThreadLocal
General purpose thread-local map.
Definition: CloseableThreadLocal.h:16
SimpleLRUCache.h
Lucene::TermInfosReader::~TermInfosReader
virtual ~TermInfosReader()
Lucene::SegmentTermEnumPtr
boost::shared_ptr< SegmentTermEnum > SegmentTermEnumPtr
Definition: LuceneTypes.h:218
Lucene::TermInfosReader::terms
SegmentTermEnumPtr terms()
Returns an enumeration of all the Terms and TermInfos in the set.
Lucene::TermInfosReader::TermInfosReader
TermInfosReader(const DirectoryPtr &dir, const String &seg, const FieldInfosPtr &fis, int32_t readBufferSize, int32_t indexDivisor)
Lucene::FieldInfosPtr
boost::shared_ptr< FieldInfos > FieldInfosPtr
Definition: LuceneTypes.h:127
Lucene::TermInfosReader::directory
DirectoryPtr directory
Definition: TermInfosReader.h:22

clucene.sourceforge.net