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
DocFieldProcessorPerThread.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 DOCFIELDPROCESSORPERTHREAD_H
8 #define DOCFIELDPROCESSORPERTHREAD_H
9
10 #include "DocConsumerPerThread.h"
11 #include "DocumentsWriter.h"
12
13 namespace Lucene
14 {
19 class DocFieldProcessorPerThread : public DocConsumerPerThread
20 {
21 public:
22 DocFieldProcessorPerThread(DocumentsWriterThreadStatePtr threadState, DocFieldProcessorPtr docFieldProcessor);
23 virtual ~DocFieldProcessorPerThread();
24
25 LUCENE_CLASS(DocFieldProcessorPerThread);
26
27 public:
28 double docBoost;
29 int32_t fieldGen;
30 DocFieldProcessorWeakPtr _docFieldProcessor;
31 FieldInfosPtr fieldInfos;
32 DocFieldConsumerPerThreadPtr consumer;
33 Collection<DocFieldProcessorPerFieldPtr> _fields; // Holds all fields seen in current doc
34 int32_t fieldCount;
35
36 Collection<DocFieldProcessorPerFieldPtr> fieldHash; // Hash table for all fields ever seen
37 int32_t hashMask;
38 int32_t totalFieldCount;
39
40 StoredFieldsWriterPerThreadPtr fieldsWriter;
41 DocStatePtr docState;
42
43 Collection<DocFieldProcessorPerThreadPerDocPtr> docFreeList;
44 int32_t freeCount;
45 int32_t allocCount;
46
47 public:
48 virtual void initialize();
49 virtual void abort();
50 Collection<DocFieldConsumerPerFieldPtr> fields();
51
52 // If there are fields we've seen but did not see again in the last run, then free them up.
53 void trimFields(SegmentWriteStatePtr state);
54
55 virtual DocWriterPtr processDocument();
56
57 DocFieldProcessorPerThreadPerDocPtr getPerDoc();
58 void freePerDoc(DocFieldProcessorPerThreadPerDocPtr perDoc);
59
60 protected:
61 void rehash();
62 };
63
64 class DocFieldProcessorPerThreadPerDoc : public DocWriter
65 {
66 public:
67 DocFieldProcessorPerThreadPerDoc(DocFieldProcessorPerThreadPtr docProcessor);
68 virtual ~DocFieldProcessorPerThreadPerDoc();
69
70 LUCENE_CLASS(DocFieldProcessorPerThreadPerDoc);
71
72 public:
73 DocWriterPtr one;
74 DocWriterPtr two;
75
76 protected:
77 DocFieldProcessorPerThreadWeakPtr _docProcessor;
78
79 public:
80 virtual int64_t sizeInBytes();
81 virtual void finish();
82 virtual void abort();
83 };
84 }
85
86 #endif

clucene.sourceforge.net