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

Loading...
Searching...
No Matches
Analyzer.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 ANALYZER_H
8#define ANALYZER_H
9
10#include "CloseableThreadLocal.h"
11
12 namespace Lucene {
13
19 class LPPAPI Analyzer : public LuceneObject {
20 public:
21 virtual ~Analyzer();
22 LUCENE_CLASS(Analyzer);
23
24 protected:
25 CloseableThreadLocal<LuceneObject> tokenStreams;
26
27 public:
30 virtual TokenStreamPtr tokenStream(const String& fieldName, const ReaderPtr& reader) = 0;
31
35 virtual TokenStreamPtr reusableTokenStream(const String& fieldName, const ReaderPtr& reader);
36
45 virtual int32_t getPositionIncrementGap(const String& fieldName);
46
53 virtual int32_t getOffsetGap(const FieldablePtr& field);
54
56 virtual void close();
57
58 protected:
61 virtual LuceneObjectPtr getPreviousTokenStream();
62
65 virtual void setPreviousTokenStream(const LuceneObjectPtr& stream);
66};
67
68}
69
70#endif
CloseableThreadLocal.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::Analyzer
An Analyzer builds TokenStreams, which analyze text. It thus represents a policy for extracting index...
Definition Analyzer.h:19
Lucene::Analyzer::setPreviousTokenStream
virtual void setPreviousTokenStream(const LuceneObjectPtr &stream)
Used by Analyzers that implement reusableTokenStream to save a TokenStream for later re-use by the sa...
Lucene::Analyzer::getOffsetGap
virtual int32_t getOffsetGap(const FieldablePtr &field)
Just like getPositionIncrementGap, except for Token offsets instead. By default this returns 1 for to...
Lucene::Analyzer::getPositionIncrementGap
virtual int32_t getPositionIncrementGap(const String &fieldName)
Invoked before indexing a Fieldable instance if terms have already been added to that field....
Lucene::Analyzer::~Analyzer
virtual ~Analyzer()
Lucene::Analyzer::reusableTokenStream
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 calle...
Lucene::Analyzer::tokenStream
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 nul...
Lucene::Analyzer::close
virtual void close()
Frees persistent resources used by this Analyzer.
Lucene::Analyzer::getPreviousTokenStream
virtual LuceneObjectPtr getPreviousTokenStream()
Used by Analyzers that implement reusableTokenStream to retrieve previously saved TokenStreams for re...
Lucene::Analyzer::tokenStreams
CloseableThreadLocal< LuceneObject > tokenStreams
Definition Analyzer.h:25
Lucene::CloseableThreadLocal
General purpose thread-local map.
Definition CloseableThreadLocal.h:16
Lucene::LuceneObject::LuceneObject
LuceneObject()
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::TokenStreamPtr
boost::shared_ptr< TokenStream > TokenStreamPtr
Definition LuceneTypes.h:63
Lucene::ReaderPtr
boost::shared_ptr< Reader > ReaderPtr
Definition LuceneTypes.h:547
Lucene::FieldablePtr
boost::shared_ptr< Fieldable > FieldablePtr
Definition LuceneTypes.h:76
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539

clucene.sourceforge.net