pub struct Query {
pub response: Response,
pub scope: Scope,
pub threshold: Threshold,
pub triggers: Vec<Trigger>,
pub id: Option<String>,
}
Expand description
Query
represents an uncompiled query. This type is
typically interstitial; it cannot perform scans, and has
little functionality apart from its ability to compile into
a CompiledQuery
.
This type is part of the public API, and therefore must comply with the structure defined in the specification.
Fields§
§response: Response
Represents the desired Response
of the query when
it matches Document
s. In other words, this is the
set of parameters for the Output
.
For more information, see the Response
documentation.
scope: Scope
Represents the documents and content that the query
is applicable to. The Scope
allows users to specify
which URLs their query is applicable to, as well as
the type of content—Text
or Raw
—that should be passed
to the triggers.
For more information, see the Scope
documentation.
threshold: Threshold
Represents the composition of trigger matches necessary in order for a match to be made.
For more information, see the Threshold
documentation.
triggers: Vec<Trigger>
Represents the Triggers
that will be checked against
the document and then processed by the Threshold
in
order to determine whether a match is made.
For more information, see the Trigger
documentation.
id: Option<String>
Represents the id
of the query. This field is optional
but highly recommended, as it will be copied to the
outputs created by this query.
Trait Implementations§
Source§impl CompilableTo<CompiledQuery> for Query
impl CompilableTo<CompiledQuery> for Query
Source§impl<'de> Deserialize<'de> for Query
impl<'de> Deserialize<'de> for Query
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Validatable for Query
impl Validatable for Query
Source§fn validate(&self) -> Option<Vec<Issue>>
fn validate(&self) -> Option<Vec<Issue>>
Validates the query, as well as all of its sub-components.
While this is an important mechanism for proper validation (note that some invalid queries will still compile), one should always double-check the results by actually compiling the query and performing a test scan.