queryBuilder
query​Builder:​*
components build search queries based on dynamically-changing inputs, such as values of
document content fields.
You can use the following query​Builder:​*
components in your analysis requests:
-
query​Builder:​aligned
-
Builds composite queries based on aligned lists of values of multi-value fields.
-
query​Builder:​filter
-
Narrows down the queries produced by the query builder you provide to the set of documents also matched by query produced by the filtering query builder.
-
query​Builder:​string
-
Builds queries based on a string template, substituting template variables with dynamic input.
query​Builder:​reference
-
References a
query​Builder:​*
component defined in the request or in the project's default components.
query​Builder:​aligned
Builds a composite query based on aligned lists of values of multi-value input.
{
"type": "queryBuilder:aligned",
"operator": "OR",
"queryBuilder": {
"type": "queryBuilder:reference",
"auto": true
},
"variables": []
}
To build the final query, this builder performs the following steps:
-
Collect lists of values for each input (e.g. document field).
-
Build "rows" (tuples) of aligned input values, one row for each position in the input list of values. The number of rows is equal to the minimum number of values across the input lists of values.
-
Invoke
label​Filter
of each query builder variable. If any input value of the row does not pass filtering, Lingo4G removes the entire row from further processing. -
Invoke the
query​Builder
for each "row" of values. Compose the resulting using theoperator
.
operator
The operator Lingo4G uses to combine queries built from individual "rows" of values.
The operator
property supports the following values:
O​R
-
Combines the queries using the OR (disjunction) operator.
A​N​D
-
Combines the queries using the AND (conjunction) operator.
query​Builder
The query builder to invoke to build a query for each "row" of aligned input values.
The inputs to the query builder will be the variables you declare in the
variables
array.
variables
The input variables to make available for the nested query builder.
query​Builder:​filter
Narrows down the queries produced by the query builder you provide to the set of documents also matched by query produced by the filtering query builder.
{
"type": "queryBuilder:filter",
"filterQueryBuilder": {
"type": "queryBuilder:reference",
"auto": true
},
"queryBuilder": {
"type": "queryBuilder:reference",
"auto": true
}
}
filter​Query​Builder
The query builder to supply the filtering queries.
query​Builder
The query builder to supply the base queries.
query​Builder:​string
Builds queries based on a string template, substituting template variables with dynamic input, such as values of document content fields.
{
"type": "queryBuilder:string",
"maxQueriesForDebugLogging": 0,
"query": "",
"queryParser": {
"type": "queryParser:project",
"queryParserKey": ""
},
"variables": []
}
max​Queries​For​Debug​Logging
The maximum number of queries to write to the analysis log.
Use this option to debug the query building process.
query
The query template to use to build queries.
The query can use any syntax supported by the
query​Parser
, by default the
enhanced query parser syntax.
Anywhere in the query template, you can use variable placeholders in the
<​V​A​R>
form, where
V​A​R
is the name of one of the variables declared in the
variables
array.
At query building time, Lingo4G replaces each variable placeholder with the variable value.
The following is an example query template referencing two variables:
N​A​M​E
and A​D​D​R​E​S​S
:
address_all:fn: maxwidth(20 fn: ordered("<NAME>" "<ADDRESS>"))
If you'd like to use the <
character in the query template, escape it with the backslash
character: \<
.
query​Parser
The query parser to use to parse the query.
variables
The variables to expose for use in the query
template.
See the query builder variable documentation for more information.
query​Builder​Variable
Represents a single variable you can use to build dynamic queries. For top-level query builders, you can use values of document content fields as variable values. Additionally, you can use directly provided (constant) variable values.
{
"ifVariableValueNotAvailable": "IGNORE",
"input": null,
"labelFilter": {
"type": "labelFilter:acceptAll"
},
"maxValues": 2147483647,
"operator": "OR",
"quote": false,
"value": null,
"variable": null
}
if​Variable​Value​Not​Available
Determines what to do if values for the variable are not available.
It may happen that values for a variable may not be available. For example, this may happen if the content field that provides variable values is empty for some document.
The if​Variable​Value​Not​Available
property supports the following values:
F​A​I​L
-
If variable values are not available for some document, the whole analysis fails with an error.
I​G​N​O​R​E
-
If variable values are not available for some document, proceed with processing.
Handling of missing values depends on the component that uses the variable. For example, the
query​Builder:​string
andquery​Builder:​aligned
components produce match-no-documents queries for documents with missing variable values.
input
Determines the variable value to use.
For top-level query builders, use names of document content fields as variable inputs. At query building time, Lingo4G sets each variable value to the value(s) of the corresponding document's content field.
label​Filter
Filters values of the variable.
Variable values that don't pass the filtering criteria will be removed from further processing.
max​Values
The maximum number of multi-valued document field to use for processing.
operator
The operator to use when joining variables having multiple values.
The operator
property supports the following values:
O​R
-
Variable values will be joined using the
O​R
(disjunction) operator. A​N​D
-
Variable values will be joined using the
A​N​D
(conjunction) operator.
quote
If true
, Lingo4G encloses each variable in double quotes before passing for further processing.
value
The constant value to set the variable to.
You can use either input
or value
in the variable definition, you cannot use both.
variable
The name of the variable.
Lingo4G uses variable names when processing query templates and when passing inputs for nested query builders.
query​Builder:​*
Consumers of
The following stages and components take query​Builder:​*
as
input: