GENIE
genie::query::Query Class Reference

#include <query.h>

Classes

struct  dim
 The second-step struct for processing queries. More...
 
struct  range
 The first-step struct for processing queries. More...
 

Public Member Functions

 Query (genie::table::inv_table *ref, int index)
 
 Query (genie::table::inv_table &ref, int index)
 
 Query ()
 
genie::table::inv_tableref_table ()
 The refrenced table's pointer. More...
 
void attr (int index, int low, int up, float weight, int order)
 Modify the matching range and weight of an attribute. More...
 
void attr (int index, int value, float weight, float selectivity, int order)
 Set an attr struct. More...
 
void attr (int index, int low, int up, float weight, float selectivity, int order)
 Set an attr struct. More...
 
void clear_dim (int index)
 Delete the dim at index. More...
 
void selectivity (float s)
 Set the selectivity. More...
 
float selectivity ()
 The selectivity of the current settings. More...
 
void apply_adaptive_query_range ()
 Construct query in adaptice range mode. More...
 
void build_and_apply_load_balance (int max_load)
 The function would construct query in the setting where load balance feature is on. More...
 
void topk (int k)
 Set top k matches. More...
 
int topk ()
 Get top k matches. More...
 
void build ()
 Construct the query based on a normal table. More...
 
void build (std::vector< dim > &)
 
int dump (std::vector< dim > &vout)
 
int dump (std::vector< range > &ranges)
 
void print (int limit)
 Print out the information of all dims. More...
 
int index ()
 Get index of the query. More...
 
int count_ranges ()
 Get value of _ count. More...
 
void build_sequence ()
 build query dim for sequence search More...
 

Public Attributes

bool is_load_balanced
 Whether this query set has been applied load balance feature. More...
 
bool use_load_balance
 Whether this query set is to use load balance. More...
 
std::vector< dim_dims
 Collection of dims of all queries. More...
 

Detailed Description

Definition at line 34 of file query.h.

Constructor & Destructor Documentation

◆ Query() [1/3]

genie::query::Query::Query ( genie::table::inv_table ref,
int  index 
)

Definition at line 38 of file query.cc.

◆ Query() [2/3]

genie::query::Query::Query ( genie::table::inv_table ref,
int  index 
)

Definition at line 51 of file query.cc.

◆ Query() [3/3]

genie::query::Query::Query ( )

Definition at line 25 of file query.cc.

Member Function Documentation

◆ apply_adaptive_query_range()

void genie::query::Query::apply_adaptive_query_range ( )

Construct query in adaptice range mode.

The function will construct adaptive query based the selectivity. Usually the range of the query would be expended after the function is called.

Definition at line 196 of file query.cc.

◆ attr() [1/3]

void genie::query::Query::attr ( int  index,
int  low,
int  up,
float  weight,
int  order 
)

Modify the matching range and weight of an attribute.

Parameters
indexAttribute index
lowLower bound (included)
upUpper bound (included)
weightThe weight
orderUsed in subsequence search

Definition at line 76 of file query.cc.

◆ attr() [2/3]

void genie::query::Query::attr ( int  index,
int  value,
float  weight,
float  selectivity,
int  order 
)

Set an attr struct.

Parameters
indexAttribute index
valueValue of this attr
weightWeight of this attr
selectivityThe selectivity
orderUsed in subsequence search

Definition at line 81 of file query.cc.

◆ attr() [3/3]

void genie::query::Query::attr ( int  index,
int  low,
int  up,
float  weight,
float  selectivity,
int  order 
)

Set an attr struct.

Parameters
indexAttribute index
lowLower bound (included)
upUpper bound (included)
weightWeight of this attr
selectivityThe selectivity
orderUsed in subsequence search

Definition at line 87 of file query.cc.

◆ build() [1/2]

void genie::query::Query::build ( )

Construct the query based on a normal table.

Definition at line 273 of file query.cc.

◆ build() [2/2]

void genie::query::Query::build ( std::vector< dim > &  )

◆ build_and_apply_load_balance()

void genie::query::Query::build_and_apply_load_balance ( int  max_load)

The function would construct query in the setting where load balance feature is on.

Parameters
max_loadMax_load = posting_list_max_length * multiplier

The function is used when load balance feature is turned on. The inverted list is divided into sublists. This function is to re-locate query range on the inverted list, based on the sublists locations.

Definition at line 141 of file query.cc.

◆ build_sequence()

void genie::query::Query::build_sequence ( )

build query dim for sequence search

Definition at line 378 of file query.cc.

◆ clear_dim()

void genie::query::Query::clear_dim ( int  index)

Delete the dim at index.

Parameters
indexThe index of the dim to be deleted.

Definition at line 116 of file query.cc.

◆ count_ranges()

int genie::query::Query::count_ranges ( )

Get value of _ count.

Definition at line 584 of file query.cc.

◆ dump() [1/2]

int genie::query::Query::dump ( std::vector< dim > &  vout)

◆ dump() [2/2]

int genie::query::Query::dump ( std::vector< range > &  ranges)

◆ index()

int genie::query::Query::index ( )

Get index of the query.

Definition at line 579 of file query.cc.

◆ print()

void genie::query::Query::print ( int  limit)

Print out the information of all dims.

Parameters
limitThe maximum number of dims to print out.

Definition at line 589 of file query.cc.

◆ ref_table()

inv_table * genie::query::Query::ref_table ( )

The refrenced table's pointer.

Returns
The pointer points to the refrenced table.

Definition at line 71 of file query.cc.

◆ selectivity() [1/2]

void genie::query::Query::selectivity ( float  s)

Set the selectivity.

Parameters
sSelectivity to set

Definition at line 131 of file query.cc.

◆ selectivity() [2/2]

float genie::query::Query::selectivity ( )

The selectivity of the current settings.

Returns
The current selectivity.

Definition at line 136 of file query.cc.

◆ topk() [1/2]

void genie::query::Query::topk ( int  k)

Set top k matches.

Parameters
kThe top k matches.

Definition at line 263 of file query.cc.

◆ topk() [2/2]

int genie::query::Query::topk ( )

Get top k matches.

Returns
The top k matches.

Definition at line 268 of file query.cc.

Member Data Documentation

◆ _dims

vector< dim > genie::query::Query::_dims

Collection of dims of all queries.

Definition at line 130 of file query.h.

◆ is_load_balanced

bool genie::query::Query::is_load_balanced

Whether this query set has been applied load balance feature.

Definition at line 121 of file query.h.

◆ use_load_balance

bool genie::query::Query::use_load_balance

Whether this query set is to use load balance.

Definition at line 125 of file query.h.


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