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

StopFilter.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 STOPFILTER_H
8 #define STOPFILTER_H
9
10 #include "TokenFilter.h"
11
12 namespace Lucene {
13
15 class LPPAPI StopFilter : public TokenFilter {
16 public:
28 StopFilter(bool enablePositionIncrements, const TokenStreamPtr& input, HashSet<String> stopWords, bool ignoreCase = false);
29 StopFilter(bool enablePositionIncrements, const TokenStreamPtr& input, const CharArraySetPtr& stopWords, bool ignoreCase = false);
30
31 virtual ~StopFilter();
32
33 LUCENE_CLASS(StopFilter);
34
35 protected:
36 CharArraySetPtr stopWords;
37 bool enablePositionIncrements;
38
39 TermAttributePtr termAtt;
40 PositionIncrementAttributePtr posIncrAtt;
41
42 public:
44 static HashSet<String> makeStopSet(Collection<String> stopWords);
45
47 virtual bool incrementToken();
48
51 static bool getEnablePositionIncrementsVersionDefault(LuceneVersion::Version matchVersion);
52
54 bool getEnablePositionIncrements();
55
63 void setEnablePositionIncrements(bool enable);
64 };
65
66 }
67
68 #endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
TokenFilter.h
Lucene::Collection< String >
Lucene::HashSet< String >
Lucene::LuceneVersion::Version
Version
Definition: Constants.h:40
Lucene::StopFilter
Removes stop words from a token stream.
Definition: StopFilter.h:15
Lucene::StopFilter::getEnablePositionIncrements
bool getEnablePositionIncrements()
Lucene::StopFilter::enablePositionIncrements
bool enablePositionIncrements
Definition: StopFilter.h:37
Lucene::StopFilter::incrementToken
virtual bool incrementToken()
Returns the next input Token whose term() is not a stop word.
Lucene::StopFilter::StopFilter
StopFilter(bool enablePositionIncrements, const TokenStreamPtr &input, HashSet< String > stopWords, bool ignoreCase=false)
Construct a token stream filtering the given input. If stopWords is an instance of CharArraySet (true...
Lucene::StopFilter::makeStopSet
static HashSet< String > makeStopSet(Collection< String > stopWords)
Builds a Set from an array of stop words, appropriate for passing into the StopFilter constructor.
Lucene::StopFilter::StopFilter
StopFilter(bool enablePositionIncrements, const TokenStreamPtr &input, const CharArraySetPtr &stopWords, bool ignoreCase=false)
Lucene::StopFilter::~StopFilter
virtual ~StopFilter()
Lucene::StopFilter::setEnablePositionIncrements
void setEnablePositionIncrements(bool enable)
If true, this StopFilter will preserve positions of the incoming tokens (ie, accumulate and set posit...
Lucene::StopFilter::posIncrAtt
PositionIncrementAttributePtr posIncrAtt
Definition: StopFilter.h:40
Lucene::StopFilter::termAtt
TermAttributePtr termAtt
Definition: StopFilter.h:39
Lucene::StopFilter::getEnablePositionIncrementsVersionDefault
static bool getEnablePositionIncrementsVersionDefault(LuceneVersion::Version matchVersion)
Returns version-dependent default for enablePositionIncrements. Analyzers that embed StopFilter use t...
Lucene::StopFilter::stopWords
CharArraySetPtr stopWords
Definition: StopFilter.h:33
Lucene::TokenFilter
A TokenFilter is a TokenStream whose input is another TokenStream.
Definition: TokenFilter.h:18
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::PositionIncrementAttributePtr
boost::shared_ptr< PositionIncrementAttribute > PositionIncrementAttributePtr
Definition: LuceneTypes.h:45
Lucene::TokenStreamPtr
boost::shared_ptr< TokenStream > TokenStreamPtr
Definition: LuceneTypes.h:63
Lucene::CharArraySetPtr
boost::shared_ptr< CharArraySet > CharArraySetPtr
Definition: LuceneTypes.h:24
Lucene::TermAttributePtr
boost::shared_ptr< TermAttribute > TermAttributePtr
Definition: LuceneTypes.h:58

clucene.sourceforge.net