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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TermInfosReader.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 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 {
19 public:
20 TermInfosReader(DirectoryPtr dir, const String& seg, FieldInfosPtr fis, int32_t readBufferSize, int32_t indexDivisor);
21 virtual ~TermInfosReader();
22
23 LUCENE_CLASS(TermInfosReader);
24
25 protected:
26 DirectoryPtr directory;
27 String segment;
28 FieldInfosPtr fieldInfos;
29 CloseableThreadLocal<TermInfosReaderThreadResources> threadResources;
30 SegmentTermEnumPtr origEnum;
31 int64_t _size;
32
33 Collection<TermPtr> indexTerms;
34 Collection<TermInfoPtr> indexInfos;
35 Collection<int64_t> indexPointers;
36
37 int32_t totalIndexInterval;
38
39 static const int32_t DEFAULT_CACHE_SIZE;
40
41 public:
42 int32_t getSkipInterval();
43 int32_t getMaxSkipLevels();
44 void close();
45
47 int64_t size();
48
50 TermInfoPtr get(TermPtr term);
51
53 int64_t getPosition(TermPtr term);
54
56 SegmentTermEnumPtr terms();
57
59 SegmentTermEnumPtr terms(TermPtr term);
60
61 protected:
62 TermInfosReaderThreadResourcesPtr getThreadResources();
63
65 int32_t getIndexOffset(TermPtr term);
66
67 void seekEnum(SegmentTermEnumPtr enumerator, int32_t indexOffset);
68
70 TermInfoPtr get(TermPtr term, bool useCache);
71
72 void ensureIndexIsRead();
73 };
74
75 class TermInfosReaderThreadResources : public LuceneObject
76 {
77 public:
78 virtual ~TermInfosReaderThreadResources();
79
80 LUCENE_CLASS(TermInfosReaderThreadResources);
81
82 public:
83 SegmentTermEnumPtr termEnum;
84
85 // Used for caching the least recently looked-up Terms
86 TermInfoCachePtr termInfoCache;
87 };
88 }
89
90 #endif

clucene.sourceforge.net