This analyzer is used to facilitate scenarios where different fields require different analysis techniques. Use addAnalyzer
to add a non-default analyzer on a field name basis.
More...
|
| PerFieldAnalyzerWrapper (const AnalyzerPtr &defaultAnalyzer) |
| Constructs with default analyzer. More...
|
|
| PerFieldAnalyzerWrapper (const AnalyzerPtr &defaultAnalyzer, MapStringAnalyzer fieldAnalyzers) |
| Constructs with default analyzer and a map of analyzers to use for specific fields. More...
|
|
virtual | ~PerFieldAnalyzerWrapper () |
|
virtual String | getClassName () |
|
boost::shared_ptr< PerFieldAnalyzerWrapper > | shared_from_this () |
|
void | addAnalyzer (const String &fieldName, const AnalyzerPtr &analyzer) |
| Defines an analyzer to use for the specified field. More...
|
|
virtual TokenStreamPtr | tokenStream (const String &fieldName, const ReaderPtr &reader) |
| Creates a TokenStream which tokenizes all the text in the provided Reader. Must be able to handle null field name for backward compatibility. More...
|
|
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. More...
|
|
virtual int32_t | getPositionIncrementGap (const String &fieldName) |
| Return the positionIncrementGap from the analyzer assigned to fieldName. More...
|
|
virtual int32_t | getOffsetGap (const FieldablePtr &field) |
| Return the offsetGap from the analyzer assigned to field. More...
|
|
virtual String | toString () |
| Returns a string representation of the object. More...
|
|
virtual | ~Analyzer () |
|
virtual String | getClassName () |
|
boost::shared_ptr< Analyzer > | shared_from_this () |
|
virtual TokenStreamPtr | tokenStream (const String &fieldName, const ReaderPtr &reader)=0 |
| Creates a TokenStream which tokenizes all the text in the provided Reader. Must be able to handle null field name for backward compatibility. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
virtual void | close () |
| Frees persistent resources used by this Analyzer. More...
|
|
virtual | ~LuceneObject () |
|
virtual void | initialize () |
| Called directly after instantiation to create objects that depend on this object being fully constructed. More...
|
|
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
| Return clone of this object. More...
|
|
virtual int32_t | hashCode () |
| Return hash code for this object. More...
|
|
virtual bool | equals (const LuceneObjectPtr &other) |
| Return whether two objects are equal. More...
|
|
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
| Compare two objects. More...
|
|
virtual String | toString () |
| Returns a string representation of the object. More...
|
|
virtual | ~LuceneSync () |
|
virtual SynchronizePtr | getSync () |
| Return this object synchronize lock. More...
|
|
virtual LuceneSignalPtr | getSignal () |
| Return this object signal. More...
|
|
virtual void | lock (int32_t timeout=0) |
| Lock this object using an optional timeout. More...
|
|
virtual void | unlock () |
| Unlock this object. More...
|
|
virtual bool | holdsLock () |
| Returns true if this object is currently locked by current thread. More...
|
|
virtual void | wait (int32_t timeout=0) |
| Wait for signal using an optional timeout. More...
|
|
virtual void | notifyAll () |
| Notify all threads waiting for signal. More...
|
|
This analyzer is used to facilitate scenarios where different fields require different analysis techniques. Use addAnalyzer
to add a non-default analyzer on a field name basis.
Example usage:
PerFieldAnalyzerWrapperPtr aWrapper = newLucene<PerFieldAnalyzerWrapper>(newLucene<StandardAnalyzer>());
aWrapper->addAnalyzer(L"firstname", newLucene<KeywordAnalyzer>());
aWrapper->addAnalyzer(L"lastname", newLucene<KeywordAnalyzer>());
In this example, StandardAnalyzer will be used for all fields except "firstname" and "lastname", for which KeywordAnalyzer will be used.
A PerFieldAnalyzerWrapper can be used like any other analyzer, for both indexing and query parsing.