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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TermsHashPerField.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 TERMSHASHPERFIELD_H
8 #define TERMSHASHPERFIELD_H
9 
11 
12 namespace Lucene {
13 
15 public:
17  virtual ~TermsHashPerField();
18 
20 
21 public:
30 
31  // Copied from our perThread
35 
36  int32_t streamCount;
37  int32_t numPostingInt;
38 
40 
42  int32_t numPostings;
43 
44  IntArray intUptos;
45  int32_t intUptoStart;
46 
47 protected:
53  bool doCall;
54  bool doNextCall;
55 
56 public:
57  virtual void initialize();
58  void shrinkHash(int32_t targetSize);
59  void reset();
60 
62  virtual void abort();
63 
64  void initReader(const ByteSliceReaderPtr& reader, const RawPostingListPtr& p, int32_t stream);
65 
68 
70  virtual void start(const FieldablePtr& field);
71 
73  virtual bool start(Collection<FieldablePtr> fields, int32_t count);
74 
75  void add(int32_t textStart);
76 
78  virtual void add();
79 
80  void writeByte(int32_t stream, int8_t b);
81  void writeBytes(int32_t stream, const uint8_t* b, int32_t offset, int32_t length);
82  void writeVInt(int32_t stream, int32_t i);
83 
85  virtual void finish();
86 
88  void rehashPostings(int32_t newSize);
89 
90 protected:
91  void compactPostings();
92 
94  bool postingEquals(const wchar_t* tokenText, int32_t tokenTextLen);
95 };
96 
97 }
98 
99 #endif
TermsHashPerField(const DocInverterPerFieldPtr &docInverterPerField, const TermsHashPerThreadPtr &perThread, const TermsHashPerThreadPtr &nextPerThread, const FieldInfoPtr &fieldInfo)
void initReader(const ByteSliceReaderPtr &reader, const RawPostingListPtr &p, int32_t stream)
bool doCall
Definition: TermsHashPerField.h:53
int32_t intUptoStart
Definition: TermsHashPerField.h:45
IntBlockPoolPtr intPool
Definition: TermsHashPerField.h:33
bool postingsCompacted
Definition: TermsHashPerField.h:41
Definition: TermsHashPerField.h:14
boost::weak_ptr< TermsHashPerThread > TermsHashPerThreadWeakPtr
Definition: LuceneTypes.h:251
boost::shared_ptr< TermsHashConsumerPerField > TermsHashConsumerPerFieldPtr
Definition: LuceneTypes.h:248
CharBlockPoolPtr charPool
Definition: TermsHashPerField.h:32
TermsHashPerThreadPtr nextPerThread
Definition: TermsHashPerField.h:25
int32_t numPostingInt
Definition: TermsHashPerField.h:37
void writeBytes(int32_t stream, const uint8_t *b, int32_t offset, int32_t length)
IntArray intUptos
Definition: TermsHashPerField.h:44
int32_t postingsHashSize
Definition: TermsHashPerField.h:48
boost::shared_ptr< IntBlockPool > IntBlockPoolPtr
Definition: LuceneTypes.h:161
bool postingEquals(const wchar_t *tokenText, int32_t tokenTextLen)
Test whether the text for current RawPostingList p equals current tokenText.
boost::shared_ptr< CharBlockPool > CharBlockPoolPtr
Definition: LuceneTypes.h:93
TermAttributePtr termAtt
Definition: TermsHashPerField.h:29
boost::shared_ptr< ByteBlockPool > ByteBlockPoolPtr
Definition: LuceneTypes.h:89
boost::shared_ptr< TermAttribute > TermAttributePtr
Definition: LuceneTypes.h:58
DocStatePtr docState
Definition: TermsHashPerField.h:27
virtual void initialize()
Called directly after instantiation to create objects that depend on this object being fully construc...
boost::shared_ptr< ByteSliceReader > ByteSliceReaderPtr
Definition: LuceneTypes.h:91
FieldInfoPtr fieldInfo
Definition: TermsHashPerField.h:39
boost::shared_ptr< TermsHashPerField > TermsHashPerFieldPtr
Definition: LuceneTypes.h:250
bool doNextCall
Definition: TermsHashPerField.h:54
boost::shared_ptr< DocInverterPerField > DocInverterPerFieldPtr
Definition: LuceneTypes.h:120
int32_t postingsHashHalfSize
Definition: TermsHashPerField.h:49
boost::shared_ptr< FieldInfo > FieldInfoPtr
Definition: LuceneTypes.h:126
void rehashPostings(int32_t newSize)
Called when postings hash is too small (> 50% occupied) or too large (< 20% occupied).
void writeByte(int32_t stream, int8_t b)
void shrinkHash(int32_t targetSize)
int32_t postingsHashMask
Definition: TermsHashPerField.h:50
boost::shared_ptr< FieldInvertState > FieldInvertStatePtr
Definition: LuceneTypes.h:128
virtual void finish()
Called once per field per document, after all Fieldable occurrences are inverted. ...
virtual void abort()
Called on hitting an aborting exception.
DocInverterPerFieldWeakPtr _docInverterPerField
Definition: TermsHashPerField.h:24
ByteBlockPoolPtr bytePool
Definition: TermsHashPerField.h:34
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
FieldInvertStatePtr fieldState
Definition: TermsHashPerField.h:28
Definition: AbstractAllTermDocs.h:12
TermsHashPerFieldPtr nextPerField
Definition: TermsHashPerField.h:23
boost::shared_ptr< Fieldable > FieldablePtr
Definition: LuceneTypes.h:76
void writeVInt(int32_t stream, int32_t i)
Collection< RawPostingListPtr > postingsHash
Definition: TermsHashPerField.h:51
Definition: InvertedDocConsumerPerField.h:14
boost::weak_ptr< DocInverterPerField > DocInverterPerFieldWeakPtr
Definition: LuceneTypes.h:120
int32_t numPostings
Definition: TermsHashPerField.h:42
TermsHashPerThreadWeakPtr _perThread
Definition: TermsHashPerField.h:26
boost::shared_ptr< TermsHashPerThread > TermsHashPerThreadPtr
Definition: LuceneTypes.h:251
boost::shared_ptr< RawPostingList > RawPostingListPtr
Definition: LuceneTypes.h:201
int32_t streamCount
Definition: TermsHashPerField.h:36
virtual void add()
Primary entry point (for first TermsHash)
boost::shared_ptr< DocState > DocStatePtr
Definition: LuceneTypes.h:122
RawPostingListPtr p
Definition: TermsHashPerField.h:52
TermsHashConsumerPerFieldPtr consumer
Definition: TermsHashPerField.h:19
Collection< RawPostingListPtr > sortPostings()
Collapse the hash table and sort in-place.
virtual void start(const FieldablePtr &field)
Called before a field instance is being processed.

clucene.sourceforge.net