strus  0.17
Public Member Functions | List of all members
strus::QueryInterface Class Referenceabstract

Defines a strus information retrieval query. More...

#include <queryInterface.hpp>

Public Member Functions

virtual ~QueryInterface ()
 Destructor. More...
 
virtual void pushTerm (const std::string &type_, const std::string &value_, const Index &length_)=0
 Push a term to the query stack. More...
 
virtual void pushDocField (const std::string &metadataRangeStart, const std::string &metadataRangeEnd)=0
 Push an expression on the query stack that defines a single field per document. The fields are represented as a sets of postings. The postings are defined as meta data elements describing the start and the end of the field for each document. More...
 
virtual void pushExpression (const PostingJoinOperatorInterface *operation, unsigned int argc, int range, unsigned int cardinality)=0
 Push an expression formed by the topmost elements from the stack to the query stack, removing the argument elements. More...
 
virtual void attachVariable (const std::string &name_)=0
 Attaches a variable to the top expression or term on the query stack. More...
 
virtual void defineFeature (const std::string &set_, double weight_=1.0)=0
 Define the topmost element of the stack as feature, removing it from the stack. More...
 
virtual void defineTermStatistics (const std::string &type_, const std::string &value_, const TermStatistics &stats_)=0
 Define the statistics of a term for the case that they are defined by the client (for example in a system with a distributed index) More...
 
virtual void defineGlobalStatistics (const GlobalStatistics &stats_)=0
 Define the global statistics for the case that they are defined by the client. More...
 
virtual void addMetaDataRestrictionCondition (const MetaDataRestrictionInterface::CompareOperator &opr, const std::string &name, const NumericVariant &operand, bool newGroup=true)=0
 Add a condition clause to the restriction on the document meta data of this query. More...
 
virtual void addDocumentEvaluationSet (const std::vector< Index > &docnolist_)=0
 Define a restriction on the documents as list of local document numbers (Add local document numbers to the list of documents to restrict the query on) More...
 
virtual void addAccess (const std::string &username_)=0
 Add a restriction for documents accessible by this query. More...
 
virtual void setMaxNofRanks (std::size_t maxNofRanks_)=0
 Set the maximum number of ranks to evaluate starting with the minimum rank. More...
 
virtual void setMinRank (std::size_t minRank_)=0
 Set the minimum rank number to return. More...
 
virtual void setWeightingVariableValue (const std::string &name, double value)=0
 Set the value of a variable in the weigthing formula defined with QueryEval::defineWeightingFormula(ScalarFunctionInterface* combinefunc) or in a weighting function or a summarizer. More...
 
virtual void setDebugMode (bool debug)=0
 Switch debug mode on or off (default off). In case of debug mode additional attributes defined with the function definitions in the query evaluation are attached to the result. More...
 
virtual QueryResult evaluate () const =0
 Evaluate the query. More...
 
virtual std::string tostring () const =0
 Map query to readable string. More...
 

Detailed Description

Defines a strus information retrieval query.

Constructor & Destructor Documentation

virtual strus::QueryInterface::~QueryInterface ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual void strus::QueryInterface::addAccess ( const std::string &  username_)
pure virtual

Add a restriction for documents accessible by this query.

Parameters
[in]username_name of user role that is allowed to see the result documents
virtual void strus::QueryInterface::addDocumentEvaluationSet ( const std::vector< Index > &  docnolist_)
pure virtual

Define a restriction on the documents as list of local document numbers (Add local document numbers to the list of documents to restrict the query on)

Parameters
[in]docnolist_list of documents to evaluate the query on
virtual void strus::QueryInterface::addMetaDataRestrictionCondition ( const MetaDataRestrictionInterface::CompareOperator opr,
const std::string &  name,
const NumericVariant &  operand,
bool  newGroup = true 
)
pure virtual

Add a condition clause to the restriction on the document meta data of this query.

Parameters
[in]oprcondition compare operator
[in]namename of meta data element to check
[in]operandconstant number to check against
[in]newGrouptrue, if the conditional opens a new group of elements joined with a logical "OR" false, if the conditional belongs to the last group of elements joined with a logical "OR". Different groups are joined with a logical "AND" to form the meta data restriction expression
virtual void strus::QueryInterface::attachVariable ( const std::string &  name_)
pure virtual

Attaches a variable to the top expression or term on the query stack.

Note
The positions of the query matches of the referenced term or expression can be accessed through this variable in summarization.
Parameters
[in]name_name of the variable attached
Remarks
The stack is not changed
More than one variable can be attached
virtual void strus::QueryInterface::defineFeature ( const std::string &  set_,
double  weight_ = 1.0 
)
pure virtual

Define the topmost element of the stack as feature, removing it from the stack.

Parameters
[in]set_name of the set of the new feature created
[in]weight_weight of the feature for the weighting function in query evaluation
virtual void strus::QueryInterface::defineGlobalStatistics ( const GlobalStatistics stats_)
pure virtual

Define the global statistics for the case that they are defined by the client.

Parameters
[in]stats_global statistics
virtual void strus::QueryInterface::defineTermStatistics ( const std::string &  type_,
const std::string &  value_,
const TermStatistics stats_ 
)
pure virtual

Define the statistics of a term for the case that they are defined by the client (for example in a system with a distributed index)

Parameters
[in]type_term type
[in]value_term value
[in]stats_term statistics
virtual QueryResult strus::QueryInterface::evaluate ( ) const
pure virtual

Evaluate the query.

Returns
result of query evaluation
virtual void strus::QueryInterface::pushDocField ( const std::string &  metadataRangeStart,
const std::string &  metadataRangeEnd 
)
pure virtual

Push an expression on the query stack that defines a single field per document. The fields are represented as a sets of postings. The postings are defined as meta data elements describing the start and the end of the field for each document.

Parameters
[in]metadataRangeStartname of metadata element that defines the start position of the field in a document
[in]metadataRangeEndname of metadata element that defines the end position of the field (first position after the field) in a document
Note
fields can be used to identify elements in a certain document area without access of posting blocks and without assigning a different feature type and thus having different statistics
virtual void strus::QueryInterface::pushExpression ( const PostingJoinOperatorInterface operation,
unsigned int  argc,
int  range,
unsigned int  cardinality 
)
pure virtual

Push an expression formed by the topmost elements from the stack to the query stack, removing the argument elements.

Parameters
[in]operationthe expression join operator
[in]argcnumber of expression arguments
[in]rangeposition proximity range of the expression
[in]cardinalityspecifies a result dimension requirement (e.g. minimum number of elements of any input subset selection that builds a result) (0 for use default). Interpretation depends on operation, but in most cases it specifies the required size for a valid result.
virtual void strus::QueryInterface::pushTerm ( const std::string &  type_,
const std::string &  value_,
const Index length_ 
)
pure virtual

Push a term to the query stack.

Parameters
[in]type_term type
[in]value_term value
[in]length_term length (ordinal position count)
virtual void strus::QueryInterface::setDebugMode ( bool  debug)
pure virtual

Switch debug mode on or off (default off). In case of debug mode additional attributes defined with the function definitions in the query evaluation are attached to the result.

Parameters
[in]debugtrue for enabling debug mode on and false for disabling debug mode (diabled by default)
virtual void strus::QueryInterface::setMaxNofRanks ( std::size_t  maxNofRanks_)
pure virtual

Set the maximum number of ranks to evaluate starting with the minimum rank.

Parameters
[in]maxNofRanks_maximum number of ranks
virtual void strus::QueryInterface::setMinRank ( std::size_t  minRank_)
pure virtual

Set the minimum rank number to return.

Parameters
[in]minRank_the minimum rank number
virtual void strus::QueryInterface::setWeightingVariableValue ( const std::string &  name,
double  value 
)
pure virtual

Set the value of a variable in the weigthing formula defined with QueryEval::defineWeightingFormula(ScalarFunctionInterface* combinefunc) or in a weighting function or a summarizer.

Parameters
[in]namename of the variable
[in]valuevalue of the variable
virtual std::string strus::QueryInterface::tostring ( ) const
pure virtual

Map query to readable string.

Returns
query with query evaluation scheme in readable form

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