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


TeeSinkTokenFilter.h
Go to the documentation of this file.
1
2// 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 TEESINKTOKENFILTER_H
8#define TEESINKTOKENFILTER_H
9
10#include "TokenFilter.h"
11#include "TokenStream.h"
12
13namespace Lucene {
14
62class LPPAPI TeeSinkTokenFilter : public TokenFilter {
63public:
67
69
70protected:
72
73public:
76
81
85
90
91 virtual bool incrementToken();
92 virtual void end();
93};
94
95class LPPAPI SinkFilter : public LuceneObject {
96public:
97 virtual ~SinkFilter();
98
100
101public:
103 virtual bool accept(const AttributeSourcePtr& source) = 0;
104
106 virtual void reset();
107};
108
109class LPPAPI AcceptAllSinkFilter : public SinkFilter {
110public:
112
114
115public:
116 virtual bool accept(const AttributeSourcePtr& source);
117};
118
120class LPPAPI SinkTokenStream : public TokenStream {
121public:
122 SinkTokenStream(const AttributeSourcePtr& source, const SinkFilterPtr& filter);
124
126
127protected:
133
134protected:
135 bool accept(const AttributeSourcePtr& source);
137 void setFinalState(const AttributeSourceStatePtr& finalState);
138
139public:
140 virtual bool incrementToken();
141 virtual void end();
142 virtual void reset();
143
144 friend class TeeSinkTokenFilter;
145};
146
147}
148
149#endif
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: TeeSinkTokenFilter.h:109
virtual bool accept(const AttributeSourcePtr &source)
Returns true, if the current state of the passed-in AttributeSource shall be stored in the sink.
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Definition: TeeSinkTokenFilter.h:95
virtual void reset()
Called by SinkTokenStream#reset(). This method does nothing by default and can optionally be overridd...
virtual bool accept(const AttributeSourcePtr &source)=0
Returns true, if the current state of the passed-in AttributeSource shall be stored in the sink.
virtual ~SinkFilter()
A filter that decides which AttributeSource states to store in the sink.
Definition: TeeSinkTokenFilter.h:120
void setFinalState(const AttributeSourceStatePtr &finalState)
virtual bool incrementToken()
Consumers (ie., IndexWriter) use this method to advance the stream to the next token....
bool accept(const AttributeSourcePtr &source)
SinkTokenStream(const AttributeSourcePtr &source, const SinkFilterPtr &filter)
AttributeSourceStatePtr finalState
Definition: TeeSinkTokenFilter.h:129
SinkFilterPtr filter
Definition: TeeSinkTokenFilter.h:132
void addState(const AttributeSourceStatePtr &state)
Collection< AttributeSourceStatePtr > cachedStates
Definition: TeeSinkTokenFilter.h:128
virtual void reset()
Resets this stream to the beginning. This is an optional operation, so subclasses may or may not impl...
Collection< AttributeSourceStatePtr >::iterator it
Definition: TeeSinkTokenFilter.h:131
virtual void end()
This method is called by the consumer after the last token has been consumed, after incrementToken() ...
bool initIterator
Definition: TeeSinkTokenFilter.h:130
This TokenFilter provides the ability to set aside attribute states that have already been analyzed....
Definition: TeeSinkTokenFilter.h:62
virtual void end()
Performs end-of-stream operations, if any, and calls then end() on the input TokenStream....
Collection< SinkTokenStreamPtr > sinks
Definition: TeeSinkTokenFilter.h:71
SinkTokenStreamPtr newSinkTokenStream(const SinkFilterPtr &filter)
Returns a new SinkTokenStream that receives all tokens consumed by this stream that pass the supplied...
SinkTokenStreamPtr newSinkTokenStream()
Returns a new SinkTokenStream that receives all tokens consumed by this stream.
void consumeAllTokens()
TeeSinkTokenFilter passes all tokens to the added sinks when itself is consumed. To be sure,...
virtual bool incrementToken()
Consumers (ie., IndexWriter) use this method to advance the stream to the next token....
TeeSinkTokenFilter(const TokenStreamPtr &input)
Instantiates a new TeeSinkTokenFilter.
void addSinkTokenStream(const SinkTokenStreamPtr &sink)
Adds a SinkTokenStream created by another TeeSinkTokenFilter to this one. The supplied stream will al...
A TokenFilter is a TokenStream whose input is another TokenStream.
Definition: TokenFilter.h:18
A TokenStream enumerates the sequence of tokens, either from Fields of a Document or from query text.
Definition: TokenStream.h:44
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< AttributeSource > AttributeSourcePtr
Definition: LuceneTypes.h:520
boost::shared_ptr< SinkFilter > SinkFilterPtr
Definition: LuceneTypes.h:47
boost::shared_ptr< TokenStream > TokenStreamPtr
Definition: LuceneTypes.h:63
boost::shared_ptr< SinkTokenStream > SinkTokenStreamPtr
Definition: LuceneTypes.h:48
boost::shared_ptr< AttributeSourceState > AttributeSourceStatePtr
Definition: LuceneTypes.h:521

clucene.sourceforge.net