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

Query program object representing a retrieval method for documents in a storage. More...

#include <bindingObjects.hpp>

Public Member Functions

 Query (const Query &o)
 Copy constructor. More...
 
 ~Query ()
 Destructor. More...
 
void defineFeature (const String &set_, const QueryExpression &expr_, double weight_=1.0)
 Create a feature from the query expression passed. More...
 
void defineDocFieldFeature (const String &set_, const String &metadataStart, const String &metadataEnd)
 Define a posting iterator describing a document field addressable as feature. More...
 
void addMetaDataRestrictionCondition (const char *compareOp, const String &name, const Variant &value, bool newGroup)
 Define a meta data restriction. More...
 
void addMetaDataRestrictionCondition (const char *compareOp, const String &name, double value, bool newGroup)
 Define a meta data restriction. More...
 
void addMetaDataRestrictionCondition (const char *compareOp, const String &name, unsigned int value, bool newGroup)
 Define a meta data restriction. More...
 
void addMetaDataRestrictionCondition (const char *compareOp, const String &name, int value, bool newGroup)
 Define a meta data restriction. More...
 
void defineTermStatistics (const String &type_, const String &value_, const TermStatistics &stats_)
 Define term statistics to use for a term for weighting it in this query. More...
 
void defineGlobalStatistics (const GlobalStatistics &stats_)
 Define the global statistics to use for weighting in this query. More...
 
void addDocumentEvaluationSet (const IndexVector &docnolist_)
 Define a set of documents the query is evaluated on. By default the query is evaluated on all documents in the storage. More...
 
void setMaxNofRanks (unsigned int maxNofRanks_)
 Set number of ranks to evaluate starting with the first rank (the maximum size of the result rank list) More...
 
void setMinRank (unsigned int minRank_)
 Set the index of the first rank to be returned. More...
 
void addUserName (const String &username_)
 Add a user for this query (as alternative role) More...
 
void setWeightingVariables (const FunctionVariableConfig &parameter)
 Assign values to variables of the weighting formula. More...
 
QueryResult evaluate () const
 Evaluate this query and return the result. More...
 
String tostring () const
 Map the contents of the query to a readable string. More...
 

Friends

class QueryEval
 

Detailed Description

Query program object representing a retrieval method for documents in a storage.

Constructor & Destructor Documentation

strus::Query::Query ( const Query o)

Copy constructor.

strus::Query::~Query ( )
inline

Destructor.

Member Function Documentation

void strus::Query::addDocumentEvaluationSet ( const IndexVector &  docnolist_)

Define a set of documents the query is evaluated on. By default the query is evaluated on all documents in the storage.

Parameters
[in]docnolist_list of documents to evaluate the query on
void strus::Query::addMetaDataRestrictionCondition ( const char *  compareOp,
const String &  name,
const Variant value,
bool  newGroup 
)

Define a meta data restriction.

Parameters
[in]compareOpcompare operator, one of "=","!=",">=","<=","<",">"
[in]nameof the meta data field (left side of comparison operator)
[in]valuenumeric value to compare with the meta data field (right side of comparison operator)
[in]newGrouptrue, if the restriction is not an alternative condition to the previous one defined (alternative conditions are evaluated as logical OR)
void strus::Query::addMetaDataRestrictionCondition ( const char *  compareOp,
const String &  name,
double  value,
bool  newGroup 
)

Define a meta data restriction.

Parameters
[in]compareOpcompare operator, one of "=","!=",">=","<=","<",">"
[in]nameof the meta data field (left side of comparison operator)
[in]valuenumeric value to compare with the meta data field (right side of comparison operator)
[in]newGrouptrue, if the restriction is not an alternative condition to the previous one defined (alternative conditions are evaluated as logical OR)
void strus::Query::addMetaDataRestrictionCondition ( const char *  compareOp,
const String &  name,
unsigned int  value,
bool  newGroup 
)

Define a meta data restriction.

Parameters
[in]compareOpcompare operator, one of "=","!=",">=","<=","<",">"
[in]nameof the meta data field (left side of comparison operator)
[in]valuenumeric value to compare with the meta data field (right side of comparison operator)
[in]newGrouptrue, if the restriction is not an alternative condition to the previous one defined (alternative conditions are evaluated as logical OR)
void strus::Query::addMetaDataRestrictionCondition ( const char *  compareOp,
const String &  name,
int  value,
bool  newGroup 
)

Define a meta data restriction.

Parameters
[in]compareOpcompare operator, one of "=","!=",">=","<=","<",">"
[in]nameof the meta data field (left side of comparison operator)
[in]valuenumeric value to compare with the meta data field (right side of comparison operator)
[in]newGrouptrue, if the restriction is not an alternative condition to the previous one defined (alternative conditions are evaluated as logical OR)
void strus::Query::addUserName ( const String &  username_)

Add a user for this query (as alternative role)

Parameters
[in]username_an alternative name of a user for the evaluation of this query
Note
the user restriction applies if no user role specified in the query is allowed to see the document.
void strus::Query::defineDocFieldFeature ( const String &  set_,
const String &  metadataStart,
const String &  metadataEnd 
)

Define a posting iterator describing a document field addressable as feature.

Parameters
[in]set_name of the feature set, this feature is addressed with
[in]metadataStartname of meta data element that defines the start of the document field, assumed as 1 if name is empty
[in]metadataEndname of meta data element that defines the end of the document field, assumed as max value if name is empty
void strus::Query::defineFeature ( const String &  set_,
const QueryExpression expr_,
double  weight_ = 1.0 
)

Create a feature from the query expression passed.

Parameters
[in]set_name of the feature set, this feature is addressed with
[in]expr_query expression that defines the postings of the feature and the variables attached
[in]weight_individual weight of the feature in the query
Remarks
the query expression passed as parameter is refused if it does not contain exactly one element
void strus::Query::defineGlobalStatistics ( const GlobalStatistics stats_)

Define the global statistics to use for weighting in this query.

Parameters
[in]stats_the structure with the statistics to set
void strus::Query::defineTermStatistics ( const String &  type_,
const String &  value_,
const TermStatistics stats_ 
)

Define term statistics to use for a term for weighting it in this query.

Parameters
[in]type_query term type name
[in]value_query term value
[in]stats_the structure with the statistics to set
QueryResult strus::Query::evaluate ( ) const

Evaluate this query and return the result.

Returns
the result
void strus::Query::setMaxNofRanks ( unsigned int  maxNofRanks_)

Set number of ranks to evaluate starting with the first rank (the maximum size of the result rank list)

Parameters
[in]maxNofRanks_maximum number of results to return by this query
void strus::Query::setMinRank ( unsigned int  minRank_)

Set the index of the first rank to be returned.

Parameters
[in]minRank_index of the first rank to be returned by this query
void strus::Query::setWeightingVariables ( const FunctionVariableConfig parameter)

Assign values to variables of the weighting formula.

Parameters
[in]parameterparameter values
String strus::Query::tostring ( ) const

Map the contents of the query to a readable string.

Returns
the string

Friends And Related Function Documentation

friend class QueryEval
friend

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