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

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
Lucene::StandardAnalyzer Class Reference

Filters `StandardTokenizer` with `StandardFilter`, `LowerCaseFilter` and `StopFilter`, using a list of English stop words. More...

`#include <StandardAnalyzer.h>`

Inheritance diagram for Lucene::StandardAnalyzer:

## Public Member Functions

| StandardAnalyzer (LuceneVersion::Version matchVersion)
| Builds an analyzer with the default stop words (`STOP_WORDS_SET`).
| StandardAnalyzer (LuceneVersion::Version matchVersion, HashSet< String > stopWords)
| Builds an analyzer with the given stop words.
| StandardAnalyzer (LuceneVersion::Version matchVersion, const String &stopwords)
| Builds an analyzer with the stop words from the given file.
| StandardAnalyzer (LuceneVersion::Version matchVersion, const ReaderPtr &stopwords)
| Builds an analyzer with the stop words from the given reader.
virtual | ~StandardAnalyzer ()
virtual String | getClassName ()
boost::shared_ptr< StandardAnalyzer > | shared_from_this ()
virtual TokenStreamPtr | tokenStream (const String &fieldName, const ReaderPtr &reader)
| Constructs a `StandardTokenizer` filtered by a `StandardFilter`, a `LowerCaseFilter` and a `StopFilter`.
void | setMaxTokenLength (int32_t length)
| Set maximum allowed token length. If a token is seen that exceeds this length then it is discarded. This setting only takes effect the next time tokenStream or reusableTokenStream is called.
int32_t | getMaxTokenLength ()
virtual TokenStreamPtr | reusableTokenStream (const String &fieldName, const ReaderPtr &reader)
| Creates a TokenStream that is allowed to be re-used from the previous time that the same thread called this method. Callers that do not need to use more than one TokenStream at the same time from this analyzer should use this method for better performance.
Public Member Functions inherited from Lucene::Analyzer
virtual | ~Analyzer ()
boost::shared_ptr< Analyzer > | shared_from_this ()
virtual int32_t | getPositionIncrementGap (const String &fieldName)

Invoked before indexing a Fieldable instance if terms have already been added to that field. This allows custom analyzers to place an automatic position increment gap between Fieldable instances using the same field name. The default value position increment gap is 0. With a 0 position increment gap and the typical default token position increment of 1, all terms in a field, including across Fieldable instances, are in successive positions, allowing exact PhraseQuery matches, for instance, across Fieldable instance boundaries.

virtual int32_t | getOffsetGap (const FieldablePtr &field)
| Just like `getPositionIncrementGap`, except for Token offsets instead. By default this returns 1 for tokenized fields and, as if the fields were joined with an extra space character, and 0 for un-tokenized fields. This method is only called if the field produced at least one token for indexing.
virtual void | close ()
| Frees persistent resources used by this Analyzer.
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed.
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Return clone of this object.
virtual int32_t | hashCode ()
| Return hash code for this object.
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal.
virtual int32_t | compareTo (const LuceneObjectPtr &other)
| Compare two objects.
virtual String | toString ()
| Returns a string representation of the object.
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock.
virtual LuceneSignalPtr | getSignal ()
| Return this object signal.
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout.
virtual void | unlock ()
| Unlock this object.
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread.
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout.
virtual void | notifyAll ()
| Notify all threads waiting for signal.

## Static Public Member Functions

static String | _getClassName ()
Static Public Member Functions inherited from Lucene::Analyzer
static String | _getClassName ()

## Static Public Attributes

static const int32_t | DEFAULT_MAX_TOKEN_LENGTH
| Default maximum allowed token length.

## Protected Member Functions

void | ConstructAnalyser (LuceneVersion::Version matchVersion, HashSet< String > stopWords)
| Construct an analyzer with the given stop words.
Protected Member Functions inherited from Lucene::Analyzer
virtual LuceneObjectPtr | getPreviousTokenStream ()
| Used by Analyzers that implement reusableTokenStream to retrieve previously saved TokenStreams for re-use by the same thread.
virtual void | setPreviousTokenStream (const LuceneObjectPtr &stream)
| Used by Analyzers that implement reusableTokenStream to save a TokenStream for later re-use by the same thread.
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Protected Attributes

HashSet< String > | stopSet
bool | replaceInvalidAcronym
| Specifies whether deprecated acronyms should be replaced with HOST type.
bool | enableStopPositionIncrements
LuceneVersion::Version | matchVersion
int32_t | maxTokenLength
Protected Attributes inherited from Lucene::Analyzer
CloseableThreadLocal< LuceneObject > | tokenStreams
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Detailed Description

Filters `StandardTokenizer` with `StandardFilter`, `LowerCaseFilter` and `StopFilter`, using a list of English stop words.

You must specify the required `Version` compatibility when creating StandardAnalyzer:

- As of 2.9, StopFilter preserves position increments
- As of 2.4, Tokens incorrectly identified as acronyms are corrected

## Constructor & Destructor Documentation

## ◆ StandardAnalyzer() [1/4]

Lucene::StandardAnalyzer::StandardAnalyzer | ( | LuceneVersion::Version | matchVersion | ) |

Builds an analyzer with the default stop words (`STOP_WORDS_SET`).

Parameters

  matchVersion | Lucene version to match.

## ◆ StandardAnalyzer() [2/4]

Lucene::StandardAnalyzer::StandardAnalyzer | ( | LuceneVersion::Version | matchVersion,
|  | HashSet< String > | stopWords
| ) |  |

Builds an analyzer with the given stop words.

Parameters

  matchVersion | Lucene version to match.
  stopWords | stop words

## ◆ StandardAnalyzer() [3/4]

Lucene::StandardAnalyzer::StandardAnalyzer | ( | LuceneVersion::Version | matchVersion,
|  | const String & | stopwords
| ) |  |

Builds an analyzer with the stop words from the given file.

See also
  WordlistLoader::getWordSet(const String&, const String&)

Parameters

  matchVersion | Lucene version to match.
  stopwords | File to read stop words from.

## ◆ StandardAnalyzer() [4/4]

Lucene::StandardAnalyzer::StandardAnalyzer | ( | LuceneVersion::Version | matchVersion,
|  | const ReaderPtr & | stopwords
| ) |  |

Builds an analyzer with the stop words from the given reader.

See also
  WordlistLoader::getWordSet(ReaderPtr, const String&)

Parameters

  matchVersion | Lucene version to match.
  stopwords | Reader to read stop words from.

## ◆ ~StandardAnalyzer()

virtual Lucene::StandardAnalyzer::~StandardAnalyzer | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

static String Lucene::StandardAnalyzer::_getClassName | ( |  | ) |

inline static

## ◆ ConstructAnalyser()

void Lucene::StandardAnalyzer::ConstructAnalyser | ( | LuceneVersion::Version | matchVersion,
|  | HashSet< String > | stopWords
| ) |  |

protected

Construct an analyzer with the given stop words.

## ◆ getClassName()

virtual String Lucene::StandardAnalyzer::getClassName | ( |  | ) |

inline virtual

Reimplemented from Lucene::Analyzer.

## ◆ getMaxTokenLength()

int32_t Lucene::StandardAnalyzer::getMaxTokenLength | ( |  | ) |

See also
  setMaxTokenLength

## ◆ reusableTokenStream()

virtual TokenStreamPtr Lucene::StandardAnalyzer::reusableTokenStream | ( | const String & | fieldName,
|  | const ReaderPtr & | reader
| ) |  |

virtual

Creates a TokenStream that is allowed to be re-used from the previous time that the same thread called this method. Callers that do not need to use more than one TokenStream at the same time from this analyzer should use this method for better performance.

Reimplemented from Lucene::Analyzer.

## ◆ setMaxTokenLength()

void Lucene::StandardAnalyzer::setMaxTokenLength | ( | int32_t | length | ) |

Set maximum allowed token length. If a token is seen that exceeds this length then it is discarded. This setting only takes effect the next time tokenStream or reusableTokenStream is called.

## ◆ shared_from_this()

boost::shared_ptr< StandardAnalyzer > Lucene::StandardAnalyzer::shared_from_this | ( |  | ) |

inline

## ◆ tokenStream()

virtual TokenStreamPtr Lucene::StandardAnalyzer::tokenStream | ( | const String & | fieldName,
|  | const ReaderPtr & | reader
| ) |  |

virtual

Constructs a `StandardTokenizer` filtered by a `StandardFilter`, a `LowerCaseFilter` and a `StopFilter`.

Implements Lucene::Analyzer.

## Field Documentation

## ◆ DEFAULT_MAX_TOKEN_LENGTH

const int32_t Lucene::StandardAnalyzer::DEFAULT_MAX_TOKEN_LENGTH

static

Default maximum allowed token length.

## ◆ enableStopPositionIncrements

bool Lucene::StandardAnalyzer::enableStopPositionIncrements

protected

## ◆ matchVersion

LuceneVersion::Version Lucene::StandardAnalyzer::matchVersion

protected

## ◆ maxTokenLength

int32_t Lucene::StandardAnalyzer::maxTokenLength

protected

## ◆ replaceInvalidAcronym

bool Lucene::StandardAnalyzer::replaceInvalidAcronym

protected

Specifies whether deprecated acronyms should be replaced with HOST type.

## ◆ stopSet

HashSet<String> Lucene::StandardAnalyzer::stopSet

protected

The documentation for this class was generated from the following file:

- StandardAnalyzer.h

clucene.sourceforge.net