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

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

clucene.sourceforge.net