strusPython  0.14
Public Member Functions | Friends | List of all members
strus::QueryAnalyzer Class Reference

Analyzer object representing a set of function for transforming a field, the smallest unit in any query language, to a set of terms that can be used to build a query. More...

#include <bindingObjects.hpp>

Public Member Functions

 QueryAnalyzer (const QueryAnalyzer &o)
 Copy constructor. More...
 
 ~QueryAnalyzer ()
 Destructor. More...
 
void addSearchIndexElement (const String &featureType, const String &fieldType, const Tokenizer &tokenizer, const NormalizerVector &normalizers)
 Defines a search index element. More...
 
void addSearchIndexElementFromPatternMatch (const std::string &type, const std::string &patternTypeName, const NormalizerVector &normalizers)
 Defines a search index element from a pattern matching result. More...
 
void addPatternLexem (const std::string &termtype, const std::string &fieldtype, const Tokenizer &tokenizer, const NormalizerVector &normalizers)
 Declare an element to be used as lexem by post processing pattern matching but not put into the result of query analysis. More...
 
void definePatternMatcherPostProc (const String &patternTypeName, const String &patternMatcherModule, const PatternMatcher &patterns)
 Declare a pattern matcher on the query features after other query analysis. More...
 
void definePatternMatcherPostProcFromFile (const String &patternTypeName, const String &patternMatcherModule, const String &serializedPatternFile)
 Declare a pattern matcher on the query features after other query analysis. More...
 
TermVector analyzeField (const String &fieldType, const String &fieldContent)
 Tokenizes and normalizes a query field and creates some typed terms out of it according the definition of the field type given. More...
 
QueryAnalyzeContext createContext () const
 Creates a context for analyzing a multipart query. More...
 

Friends

class Context
 Constructor used by Context. More...
 

Detailed Description

Analyzer object representing a set of function for transforming a field, the smallest unit in any query language, to a set of terms that can be used to build a query.

Remarks
The only way to construct a query analyzer instance is to call Context::createQueryAnalyzer()

Constructor & Destructor Documentation

strus::QueryAnalyzer::QueryAnalyzer ( const QueryAnalyzer o)

Copy constructor.

strus::QueryAnalyzer::~QueryAnalyzer ( )
inline

Destructor.

Member Function Documentation

void strus::QueryAnalyzer::addPatternLexem ( const std::string &  termtype,
const std::string &  fieldtype,
const Tokenizer tokenizer,
const NormalizerVector normalizers 
)

Declare an element to be used as lexem by post processing pattern matching but not put into the result of query analysis.

Parameters
[in]termtypeterm type name of the lexem to be feed to the pattern matching
[in]fieldtypetype of the field of this element in the query
[in]tokenizertokenizer function description to use for the features of this field type
[in]normalizerslist of normalizer function description to use for the features of this field type in the ascending order of appearance
void strus::QueryAnalyzer::addSearchIndexElement ( const String &  featureType,
const String &  fieldType,
const Tokenizer tokenizer,
const NormalizerVector normalizers 
)

Defines a search index element.

Parameters
[in]featureTypeelement feature type created from this field type
[in]fieldTypename of the field type defined
[in]tokenizertokenizer function description to use for the features of this field type
[in]normalizerslist of normalizer function description to use for the features of this field type in the ascending order of appearance
void strus::QueryAnalyzer::addSearchIndexElementFromPatternMatch ( const std::string &  type,
const std::string &  patternTypeName,
const NormalizerVector normalizers 
)

Defines a search index element from a pattern matching result.

Parameters
[in]typeelement type created from this pattern match result type
[in]patternTypeNamename of the pattern match result item
[in]normalizerslist of normalizer functions
TermVector strus::QueryAnalyzer::analyzeField ( const String &  fieldType,
const String &  fieldContent 
)

Tokenizes and normalizes a query field and creates some typed terms out of it according the definition of the field type given.

Parameters
[in]fieldTypename of the field type to use for analysis
[in]fieldContentcontent string of the query field to analyze
Note
This is a very simplistic method to analyze a query. For multi field queries the object QueryAnalyzeContext is more appropriate
QueryAnalyzeContext strus::QueryAnalyzer::createContext ( ) const

Creates a context for analyzing a multipart query.

Returns
the queue
void strus::QueryAnalyzer::definePatternMatcherPostProc ( const String &  patternTypeName,
const String &  patternMatcherModule,
const PatternMatcher patterns 
)

Declare a pattern matcher on the query features after other query analysis.

Parameters
[in]patternTypeNamename of the type to assign to the pattern matching results
[in]patternMatcherModulemodule id of pattern matcher to use (empty string for default)
[in]patternsstructure with all patterns
void strus::QueryAnalyzer::definePatternMatcherPostProcFromFile ( const String &  patternTypeName,
const String &  patternMatcherModule,
const String &  serializedPatternFile 
)

Declare a pattern matcher on the query features after other query analysis.

Parameters
[in]patternTypeNamename of the type to assign to the pattern matching results
[in]patternMatcherModulemodule id of pattern matcher to use (empty string for default)
[in]serializedPatternFilepath to file with serialized (binary) patterns

Friends And Related Function Documentation

friend class Context
friend

Constructor used by Context.


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