Class _FilterHints
source code
Class for filter analytics.
When filters are used, the user of the Query class usually
doesn't know exactly which items will be necessary for building the
result. It therefore has to prepare and compute the input data for
potentially returning everything.
There are two ways to optimize this. The first, and simpler, is to
assign each field a group of data, so that the caller can determine which
computations are necessary depending on the data groups requested. The
list of referenced groups must also be computed for fields referenced in
the filter.
The second is restricting the items based on a primary key. The
primary key is usually a unique name (e.g. a node name). This class
extracts all referenced names from a filter. If it encounters any filter
condition which disallows such a list to be determined (e.g. a
non-equality filter), all names will be requested.
The end-effect is that any operation other than qlang.OP_OR and qlang.OP_EQUAL
will make the query more expensive.
|
|
list
|
|
|
ReferencedData(self)
Returns all kinds of data referenced by the filter. |
source code
|
|
|
_NeedAllNames(self)
Changes internal state to request all names. |
source code
|
|
|
|
|
|
|
|
|
_allnames
Whether all names need to be requested (e.g.
|
|
_names
Which names to request
|
|
_datakinds
Data kinds referenced by the filter (used by Query.RequestedData)
|
Initializes this class.
- Parameters:
namefield (string) - Field caller is interested in
|
Returns all requested values.
Returns None if list of values can't be determined (e.g.
encountered non-equality operators).
- Returns: list
|
Called when handling a logic operation.
- Parameters:
|
Called when handling an unary operation.
- Parameters:
|
NoteBinaryOp(self,
op,
datakind,
name,
value)
| source code
|
Called when handling a binary operation.
- Parameters:
op (string) - Operator
name (string) - Left-hand side of operator (field name)
value - Right-hand side of operator
|
_allnames
Whether all names need to be requested (e.g. if a non-equality
operator has been used)
|