#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct BoolQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub filter: ::core::option::Option<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub must: ::core::option::Option<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub must_not: ::core::option::Option<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub should: ::core::option::Option<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
}
impl BoolQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
filter: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
must: ::core::option::Option::None,
must_not: ::core::option::Option::None,
should: ::core::option::Option::None,
}
}
}
impl BoolQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn filter(
mut self,
value: impl ::core::convert::Into<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
) -> Self {
self.filter = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn must(
mut self,
value: impl ::core::convert::Into<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
) -> Self {
self.must = ::core::option::Option::Some(value.into());
self
}
pub fn must_not(
mut self,
value: impl ::core::convert::Into<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
) -> Self {
self.must_not = ::core::option::Option::Some(value.into());
self
}
pub fn should(
mut self,
value: impl ::core::convert::Into<
::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
>,
) -> Self {
self.should = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct BoostingQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub negative_boost: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub negative: ::core::option::Option<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub positive: ::core::option::Option<crate::query_dsl::QueryContainer>,
}
impl BoostingQuery {
pub fn new(
negative_boost: f64,
negative: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
positive: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
negative_boost: ::core::option::Option::Some(negative_boost.into()),
negative: ::core::option::Option::Some(negative.into()),
positive: ::core::option::Option::Some(positive.into()),
}
}
}
impl BoostingQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ChildScoreMode {
None,
Avg,
Sum,
Max,
Min,
Raw(::std::string::String),
}
impl ChildScoreMode {
pub fn as_str(&self) -> &str {
match self {
Self::None => "none",
Self::Avg => "avg",
Self::Sum => "sum",
Self::Max => "max",
Self::Min => "min",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"none" => ::core::option::Option::Some(Self::None),
"avg" => ::core::option::Option::Some(Self::Avg),
"sum" => ::core::option::Option::Some(Self::Sum),
"max" => ::core::option::Option::Some(Self::Max),
"min" => ::core::option::Option::Some(Self::Min),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for ChildScoreMode {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for ChildScoreMode {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"ChildScoreMode",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum CombinedFieldsOperator {
Or,
And,
Raw(::std::string::String),
}
impl CombinedFieldsOperator {
pub fn as_str(&self) -> &str {
match self {
Self::Or => "or",
Self::And => "and",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"or" => ::core::option::Option::Some(Self::Or),
"and" => ::core::option::Option::Some(Self::And),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for CombinedFieldsOperator {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for CombinedFieldsOperator {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"CombinedFieldsOperator",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct CombinedFieldsQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(default = "::core::default::Default::default")]
pub fields: ::std::vec::Vec<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub operator: ::core::option::Option<crate::query_dsl::CombinedFieldsOperator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub zero_terms_query: ::core::option::Option<crate::query_dsl::CombinedFieldsZeroTerms>,
}
impl CombinedFieldsQuery {
pub fn new(
fields: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
query: impl ::core::convert::Into<::std::string::String>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
fields: fields.into(),
query: ::core::option::Option::Some(query.into()),
auto_generate_synonyms_phrase_query: ::core::option::Option::None,
operator: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
zero_terms_query: ::core::option::Option::None,
}
}
}
impl CombinedFieldsQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
self
}
pub fn operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::CombinedFieldsOperator>,
) -> Self {
self.operator = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn zero_terms_query(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::CombinedFieldsZeroTerms>,
) -> Self {
self.zero_terms_query = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum CombinedFieldsZeroTerms {
None,
All,
Raw(::std::string::String),
}
impl CombinedFieldsZeroTerms {
pub fn as_str(&self) -> &str {
match self {
Self::None => "none",
Self::All => "all",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"none" => ::core::option::Option::Some(Self::None),
"all" => ::core::option::Option::Some(Self::All),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for CombinedFieldsZeroTerms {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for CombinedFieldsZeroTerms {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"CombinedFieldsZeroTerms",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct CommonTermsQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub analyzer: ::core::option::Option<::std::string::String>,
pub cutoff_frequency: ::core::option::Option<f64>,
pub high_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
pub low_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
pub query: ::core::option::Option<::std::string::String>,
}
impl CommonTermsQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
cutoff_frequency: ::core::option::Option::None,
high_freq_operator: ::core::option::Option::None,
low_freq_operator: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
}
}
}
impl CommonTermsQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn cutoff_frequency(mut self, value: f64) -> Self {
self.cutoff_frequency = ::core::option::Option::Some(value.into());
self
}
pub fn high_freq_operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::Operator>,
) -> Self {
self.high_freq_operator = ::core::option::Option::Some(value.into());
self
}
pub fn low_freq_operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::Operator>,
) -> Self {
self.low_freq_operator = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "CommonTermsQuery")]
struct CommonTermsQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
cutoff_frequency: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
high_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
low_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
query: ::core::option::Option<::std::string::String>,
}
impl ::serde::Serialize for CommonTermsQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.query,
self.boost.is_none()
&& self.name.is_none()
&& self.analyzer.is_none()
&& self.cutoff_frequency.is_none()
&& self.high_freq_operator.is_none()
&& self.low_freq_operator.is_none()
&& self.minimum_should_match.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
CommonTermsQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for CommonTermsQuery {
type Short = ::std::string::String;
fn from_short(short: ::std::string::String) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
cutoff_frequency: ::core::option::Option::None,
high_freq_operator: ::core::option::Option::None,
low_freq_operator: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
query: ::core::option::Option::Some(short),
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
CommonTermsQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for CommonTermsQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ConstantScoreQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub filter: ::core::option::Option<crate::query_dsl::QueryContainer>,
}
impl ConstantScoreQuery {
pub fn new(filter: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
filter: ::core::option::Option::Some(filter.into()),
}
}
}
impl ConstantScoreQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "DateDecayFunctionRepr", into = "DateDecayFunctionRepr")]
#[non_exhaustive]
pub struct DateDecayFunction {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
pub field: crate::Field,
pub placement: crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
}
impl DateDecayFunction {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
placement: impl ::core::convert::Into<
crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
>,
) -> Self {
Self {
multi_value_mode: ::core::option::Option::None,
field: field.into(),
placement: placement.into(),
}
}
}
impl DateDecayFunction {
pub fn multi_value_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
) -> Self {
self.multi_value_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct DateDecayFunctionRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<
crate::Field,
crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
>,
}
impl ::core::convert::TryFrom<DateDecayFunctionRepr> for DateDecayFunction {
type Error = ::std::string::String;
fn try_from(repr: DateDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
multi_value_mode: repr.multi_value_mode,
field,
placement,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"DateDecayFunction needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<DateDecayFunction> for DateDecayFunctionRepr {
fn from(value: DateDecayFunction) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.placement);
Self {
multi_value_mode: value.multi_value_mode,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct DateDistanceFeatureQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub origin: ::core::option::Option<crate::DateMath>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pivot: ::core::option::Option<crate::Duration>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
}
impl DateDistanceFeatureQuery {
pub fn new(
origin: impl ::core::convert::Into<crate::DateMath>,
pivot: impl ::core::convert::Into<crate::Duration>,
field: impl ::core::convert::Into<crate::Field>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
origin: ::core::option::Option::Some(origin.into()),
pivot: ::core::option::Option::Some(pivot.into()),
field: ::core::option::Option::Some(field.into()),
}
}
}
impl DateDistanceFeatureQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct DateRangeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gt: ::core::option::Option<crate::DateMath>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gte: ::core::option::Option<crate::DateMath>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lt: ::core::option::Option<crate::DateMath>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lte: ::core::option::Option<crate::DateMath>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub format: ::core::option::Option<crate::DateFormat>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub time_zone: ::core::option::Option<crate::TimeZone>,
}
impl DateRangeQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
relation: ::core::option::Option::None,
gt: ::core::option::Option::None,
gte: ::core::option::Option::None,
lt: ::core::option::Option::None,
lte: ::core::option::Option::None,
format: ::core::option::Option::None,
time_zone: ::core::option::Option::None,
}
}
}
impl DateRangeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn relation(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
pub fn gt(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
self.gt = ::core::option::Option::Some(value.into());
self
}
pub fn gte(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
self.gte = ::core::option::Option::Some(value.into());
self
}
pub fn lt(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
self.lt = ::core::option::Option::Some(value.into());
self
}
pub fn lte(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
self.lte = ::core::option::Option::Some(value.into());
self
}
pub fn format(mut self, value: impl ::core::convert::Into<crate::DateFormat>) -> Self {
self.format = ::core::option::Option::Some(value.into());
self
}
pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
self.time_zone = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DecayFunction {
Untyped(crate::query_dsl::UntypedDecayFunction),
Date(crate::query_dsl::DateDecayFunction),
Numeric(crate::query_dsl::NumericDecayFunction),
Geo(crate::query_dsl::GeoDecayFunction),
}
impl ::serde::Serialize for DecayFunction {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
Self::Numeric(value) => ::serde::Serialize::serialize(value, serializer),
Self::Geo(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for DecayFunction {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
}
}
impl ::core::convert::From<crate::query_dsl::UntypedDecayFunction> for DecayFunction {
fn from(value: crate::query_dsl::UntypedDecayFunction) -> Self {
Self::Untyped(value)
}
}
impl ::core::convert::From<crate::query_dsl::DateDecayFunction> for DecayFunction {
fn from(value: crate::query_dsl::DateDecayFunction) -> Self {
Self::Date(value)
}
}
impl ::core::convert::From<crate::query_dsl::NumericDecayFunction> for DecayFunction {
fn from(value: crate::query_dsl::NumericDecayFunction) -> Self {
Self::Numeric(value)
}
}
impl ::core::convert::From<crate::query_dsl::GeoDecayFunction> for DecayFunction {
fn from(value: crate::query_dsl::GeoDecayFunction) -> Self {
Self::Geo(value)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(
try_from = "DecayFunctionBaseRepr<TOrigin, TScale>",
into = "DecayFunctionBaseRepr<TOrigin, TScale>"
)]
#[serde(bound(
serialize = "TOrigin: ::serde::Serialize + ::core::clone::Clone, TScale: ::serde::Serialize + ::core::clone::Clone"
))]
#[non_exhaustive]
pub struct DecayFunctionBase<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
pub field: crate::Field,
pub placement: crate::query_dsl::DecayPlacement<TOrigin, TScale>,
}
impl<TOrigin, TScale> DecayFunctionBase<TOrigin, TScale> {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
placement: impl ::core::convert::Into<crate::query_dsl::DecayPlacement<TOrigin, TScale>>,
) -> Self {
Self {
multi_value_mode: ::core::option::Option::None,
field: field.into(),
placement: placement.into(),
}
}
}
impl<TOrigin, TScale> DecayFunctionBase<TOrigin, TScale> {
pub fn multi_value_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
) -> Self {
self.multi_value_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct DecayFunctionBaseRepr<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::DecayPlacement<TOrigin, TScale>>,
}
impl<TOrigin, TScale> ::core::convert::TryFrom<DecayFunctionBaseRepr<TOrigin, TScale>>
for DecayFunctionBase<TOrigin, TScale>
{
type Error = ::std::string::String;
fn try_from(
repr: DecayFunctionBaseRepr<TOrigin, TScale>,
) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
multi_value_mode: repr.multi_value_mode,
field,
placement,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"DecayFunctionBase needs exactly one property keyed by its field",
)),
}
}
}
impl<TOrigin, TScale> ::core::convert::From<DecayFunctionBase<TOrigin, TScale>>
for DecayFunctionBaseRepr<TOrigin, TScale>
{
fn from(value: DecayFunctionBase<TOrigin, TScale>) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.placement);
Self {
multi_value_mode: value.multi_value_mode,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct DecayPlacement<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub decay: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub offset: ::core::option::Option<TScale>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub scale: ::core::option::Option<TScale>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub origin: ::core::option::Option<TOrigin>,
}
impl DecayPlacement<::serde_json::Value, ::serde_json::Value> {
pub fn new() -> Self {
Self {
decay: ::core::option::Option::None,
offset: ::core::option::Option::None,
scale: ::core::option::Option::None,
origin: ::core::option::Option::None,
}
}
}
impl<TOrigin, TScale> DecayPlacement<TOrigin, TScale> {
pub fn decay(mut self, value: f64) -> Self {
self.decay = ::core::option::Option::Some(value.into());
self
}
pub fn offset(mut self, value: TScale) -> Self {
self.offset = ::core::option::Option::Some(value.into());
self
}
pub fn scale(mut self, value: TScale) -> Self {
self.scale = ::core::option::Option::Some(value.into());
self
}
pub fn origin<TOrigin2>(self, value: TOrigin2) -> DecayPlacement<TOrigin2, TScale> {
DecayPlacement {
decay: self.decay,
offset: self.offset,
scale: self.scale,
origin: ::core::option::Option::Some(value.into()),
}
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct DisMaxQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(default = "::core::default::Default::default")]
pub queries: ::std::vec::Vec<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub tie_breaker: ::core::option::Option<f64>,
}
impl DisMaxQuery {
pub fn new(
queries: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::QueryContainer>>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
queries: queries.into(),
tie_breaker: ::core::option::Option::None,
}
}
}
impl DisMaxQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn tie_breaker(mut self, value: f64) -> Self {
self.tie_breaker = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DistanceFeatureQuery {
Untyped(crate::query_dsl::UntypedDistanceFeatureQuery),
Geo(crate::query_dsl::GeoDistanceFeatureQuery),
Date(crate::query_dsl::DateDistanceFeatureQuery),
}
impl ::serde::Serialize for DistanceFeatureQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
Self::Geo(value) => ::serde::Serialize::serialize(value, serializer),
Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for DistanceFeatureQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
}
}
impl ::core::convert::From<crate::query_dsl::UntypedDistanceFeatureQuery> for DistanceFeatureQuery {
fn from(value: crate::query_dsl::UntypedDistanceFeatureQuery) -> Self {
Self::Untyped(value)
}
}
impl ::core::convert::From<crate::query_dsl::GeoDistanceFeatureQuery> for DistanceFeatureQuery {
fn from(value: crate::query_dsl::GeoDistanceFeatureQuery) -> Self {
Self::Geo(value)
}
}
impl ::core::convert::From<crate::query_dsl::DateDistanceFeatureQuery> for DistanceFeatureQuery {
fn from(value: crate::query_dsl::DateDistanceFeatureQuery) -> Self {
Self::Date(value)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct DistanceFeatureQueryBase<TOrigin = ::serde_json::Value, TDistance = ::serde_json::Value>
{
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
pub origin: TOrigin,
pub pivot: TDistance,
pub field: crate::Field,
}
impl<TOrigin, TDistance> DistanceFeatureQueryBase<TOrigin, TDistance> {
pub fn new(
origin: TOrigin,
pivot: TDistance,
field: impl ::core::convert::Into<crate::Field>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
origin: origin.into(),
pivot: pivot.into(),
field: field.into(),
}
}
}
impl<TOrigin, TDistance> DistanceFeatureQueryBase<TOrigin, TDistance> {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ExistsQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
}
impl ExistsQuery {
pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
field: ::core::option::Option::Some(field.into()),
}
}
}
impl ExistsQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct FieldAndFormat {
pub field: ::core::option::Option<crate::Field>,
pub format: ::core::option::Option<::std::string::String>,
pub include_unmapped: ::core::option::Option<bool>,
}
impl FieldAndFormat {
pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
Self {
field: ::core::option::Option::Some(field.into()),
format: ::core::option::Option::None,
include_unmapped: ::core::option::Option::None,
}
}
}
impl FieldAndFormat {
pub fn format(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.format = ::core::option::Option::Some(value.into());
self
}
pub fn include_unmapped(mut self, value: bool) -> Self {
self.include_unmapped = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "FieldAndFormat")]
struct FieldAndFormatDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
format: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
include_unmapped: ::core::option::Option<bool>,
}
impl ::serde::Serialize for FieldAndFormat {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.field,
self.format.is_none() && self.include_unmapped.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
FieldAndFormatDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FieldAndFormat {
type Short = crate::Field;
fn from_short(short: crate::Field) -> Self {
Self {
field: ::core::option::Option::Some(short),
format: ::core::option::Option::None,
include_unmapped: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
FieldAndFormatDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for FieldAndFormat {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct FieldLookup {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub id: ::core::option::Option<crate::Id>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub index: ::core::option::Option<crate::IndexName>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub path: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub routing: ::core::option::Option<::std::string::String>,
}
impl FieldLookup {
pub fn new(id: impl ::core::convert::Into<crate::Id>) -> Self {
Self {
id: ::core::option::Option::Some(id.into()),
index: ::core::option::Option::None,
path: ::core::option::Option::None,
routing: ::core::option::Option::None,
}
}
}
impl FieldLookup {
pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
self.index = ::core::option::Option::Some(value.into());
self
}
pub fn path(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.path = ::core::option::Option::Some(value.into());
self
}
pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.routing = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FieldValueFactorModifier {
None,
Log,
Log1P,
Log2P,
Ln,
Ln1P,
Ln2P,
Square,
Sqrt,
Reciprocal,
Raw(::std::string::String),
}
impl FieldValueFactorModifier {
pub fn as_str(&self) -> &str {
match self {
Self::None => "none",
Self::Log => "log",
Self::Log1P => "log1p",
Self::Log2P => "log2p",
Self::Ln => "ln",
Self::Ln1P => "ln1p",
Self::Ln2P => "ln2p",
Self::Square => "square",
Self::Sqrt => "sqrt",
Self::Reciprocal => "reciprocal",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"none" => ::core::option::Option::Some(Self::None),
"log" => ::core::option::Option::Some(Self::Log),
"log1p" => ::core::option::Option::Some(Self::Log1P),
"log2p" => ::core::option::Option::Some(Self::Log2P),
"ln" => ::core::option::Option::Some(Self::Ln),
"ln1p" => ::core::option::Option::Some(Self::Ln1P),
"ln2p" => ::core::option::Option::Some(Self::Ln2P),
"square" => ::core::option::Option::Some(Self::Square),
"sqrt" => ::core::option::Option::Some(Self::Sqrt),
"reciprocal" => ::core::option::Option::Some(Self::Reciprocal),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for FieldValueFactorModifier {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for FieldValueFactorModifier {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"FieldValueFactorModifier",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct FieldValueFactorScoreFunction {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub factor: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub missing: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub modifier: ::core::option::Option<crate::query_dsl::FieldValueFactorModifier>,
}
impl FieldValueFactorScoreFunction {
pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
Self {
field: ::core::option::Option::Some(field.into()),
factor: ::core::option::Option::None,
missing: ::core::option::Option::None,
modifier: ::core::option::Option::None,
}
}
}
impl FieldValueFactorScoreFunction {
pub fn factor(mut self, value: f64) -> Self {
self.factor = ::core::option::Option::Some(value.into());
self
}
pub fn missing(mut self, value: f64) -> Self {
self.missing = ::core::option::Option::Some(value.into());
self
}
pub fn modifier(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::FieldValueFactorModifier>,
) -> Self {
self.modifier = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FunctionBoostMode {
Multiply,
Replace,
Sum,
Avg,
Max,
Min,
Raw(::std::string::String),
}
impl FunctionBoostMode {
pub fn as_str(&self) -> &str {
match self {
Self::Multiply => "multiply",
Self::Replace => "replace",
Self::Sum => "sum",
Self::Avg => "avg",
Self::Max => "max",
Self::Min => "min",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"multiply" => ::core::option::Option::Some(Self::Multiply),
"replace" => ::core::option::Option::Some(Self::Replace),
"sum" => ::core::option::Option::Some(Self::Sum),
"avg" => ::core::option::Option::Some(Self::Avg),
"max" => ::core::option::Option::Some(Self::Max),
"min" => ::core::option::Option::Some(Self::Min),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for FunctionBoostMode {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for FunctionBoostMode {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"FunctionBoostMode",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FunctionScoreContainerVariant {
Exp(crate::query_dsl::DecayFunction),
Gauss(crate::query_dsl::DecayFunction),
Linear(crate::query_dsl::DecayFunction),
FieldValueFactor(crate::query_dsl::FieldValueFactorScoreFunction),
RandomScore(crate::query_dsl::RandomScoreFunction),
ScriptScore(crate::query_dsl::ScriptScoreFunction),
Raw(::serde_json::Value),
}
impl FunctionScoreContainerVariant {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::Exp(value) => map.serialize_entry("exp", value),
Self::Gauss(value) => map.serialize_entry("gauss", value),
Self::Linear(value) => map.serialize_entry("linear", value),
Self::FieldValueFactor(value) => map.serialize_entry("field_value_factor", value),
Self::RandomScore(value) => map.serialize_entry("random_score", value),
Self::ScriptScore(value) => map.serialize_entry("script_score", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for FunctionScoreContainerVariant {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Exp(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "exp", value)
}
Self::Gauss(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "gauss", value)
}
Self::Linear(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "linear", value)
}
Self::FieldValueFactor(value) => ::oxsearch_core::__private::serialize_variant(
serializer,
"field_value_factor",
value,
),
Self::RandomScore(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "random_score", value)
}
Self::ScriptScore(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "script_score", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for FunctionScoreContainerVariant {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for FunctionScoreContainerVariant {
const NAME: &'static str = "FunctionScoreContainerVariant";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"exp" => Self::Exp(map.next_value()?),
"gauss" => Self::Gauss(map.next_value()?),
"linear" => Self::Linear(map.next_value()?),
"field_value_factor" => Self::FieldValueFactor(map.next_value()?),
"random_score" => Self::RandomScore(map.next_value()?),
"script_score" => Self::ScriptScore(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<crate::query_dsl::FieldValueFactorScoreFunction>
for FunctionScoreContainerVariant
{
fn from(value: crate::query_dsl::FieldValueFactorScoreFunction) -> Self {
Self::FieldValueFactor(value)
}
}
impl ::core::convert::From<crate::query_dsl::RandomScoreFunction>
for FunctionScoreContainerVariant
{
fn from(value: crate::query_dsl::RandomScoreFunction) -> Self {
Self::RandomScore(value)
}
}
impl ::core::convert::From<crate::query_dsl::ScriptScoreFunction>
for FunctionScoreContainerVariant
{
fn from(value: crate::query_dsl::ScriptScoreFunction) -> Self {
Self::ScriptScore(value)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct FunctionScoreContainer {
pub filter: ::core::option::Option<crate::query_dsl::QueryContainer>,
pub weight: ::core::option::Option<f64>,
pub name: ::core::option::Option<::std::string::String>,
pub variant: ::core::option::Option<crate::query_dsl::FunctionScoreContainerVariant>,
}
impl FunctionScoreContainer {
pub fn new() -> Self {
Self {
filter: ::core::option::Option::None,
weight: ::core::option::Option::None,
name: ::core::option::Option::None,
variant: ::core::option::Option::None,
}
}
}
impl FunctionScoreContainer {
pub fn filter(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
) -> Self {
self.filter = ::core::option::Option::Some(value.into());
self
}
pub fn weight(mut self, value: f64) -> Self {
self.weight = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn variant(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::FunctionScoreContainerVariant>,
) -> Self {
self.variant = ::core::option::Option::Some(value.into());
self
}
}
impl ::serde::Serialize for FunctionScoreContainer {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
use ::serde::ser::SerializeMap as _;
let mut map = serializer.serialize_map(::core::option::Option::None)?;
if let ::core::option::Option::Some(value) = &self.filter {
map.serialize_entry("filter", value)?;
}
if let ::core::option::Option::Some(value) = &self.weight {
map.serialize_entry("weight", value)?;
}
if let ::core::option::Option::Some(value) = &self.name {
map.serialize_entry("_name", value)?;
}
if let ::core::option::Option::Some(variant) = &self.variant {
variant.serialize_entry(&mut map)?;
}
map.end()
}
}
impl<'de> ::serde::Deserialize<'de> for FunctionScoreContainer {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Fields;
impl<'de> ::serde::de::Visitor<'de> for Fields {
type Value = FunctionScoreContainer;
fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.write_str("a FunctionScoreContainer object")
}
fn visit_map<A__: ::serde::de::MapAccess<'de>>(
self,
mut map: A__,
) -> ::core::result::Result<FunctionScoreContainer, A__::Error> {
let mut filter = ::core::option::Option::None;
let mut weight = ::core::option::Option::None;
let mut name = ::core::option::Option::None;
let mut variant__ = ::core::option::Option::None;
while let ::core::option::Option::Some(key) =
map.next_key::<::std::string::String>()?
{
match key.as_str() {
"filter" => filter = ::core::option::Option::Some(map.next_value()?),
"weight" => weight = ::core::option::Option::Some(map.next_value()?),
"_name" => name = ::core::option::Option::Some(map.next_value()?),
_ => {
if variant__.is_some() {
return ::core::result::Result::Err(
::oxsearch_core::__private::two_variants(
"FunctionScoreContainer",
&key,
),
);
}
variant__ = ::core::option::Option::Some(<FunctionScoreContainerVariant as ::oxsearch_core::__private::Container<'de>>::variant(&key, &mut map)?);
}
}
}
::core::result::Result::Ok(FunctionScoreContainer {
filter,
weight,
name,
variant: variant__,
})
}
}
deserializer.deserialize_map(Fields)
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FunctionScoreMode {
Multiply,
Sum,
Avg,
First,
Max,
Min,
Raw(::std::string::String),
}
impl FunctionScoreMode {
pub fn as_str(&self) -> &str {
match self {
Self::Multiply => "multiply",
Self::Sum => "sum",
Self::Avg => "avg",
Self::First => "first",
Self::Max => "max",
Self::Min => "min",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"multiply" => ::core::option::Option::Some(Self::Multiply),
"sum" => ::core::option::Option::Some(Self::Sum),
"avg" => ::core::option::Option::Some(Self::Avg),
"first" => ::core::option::Option::Some(Self::First),
"max" => ::core::option::Option::Some(Self::Max),
"min" => ::core::option::Option::Some(Self::Min),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for FunctionScoreMode {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for FunctionScoreMode {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"FunctionScoreMode",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct FunctionScoreQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub boost_mode: ::core::option::Option<crate::query_dsl::FunctionBoostMode>,
pub functions:
::core::option::Option<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
pub max_boost: ::core::option::Option<f64>,
pub min_score: ::core::option::Option<f64>,
pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
pub score_mode: ::core::option::Option<crate::query_dsl::FunctionScoreMode>,
}
impl FunctionScoreQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
boost_mode: ::core::option::Option::None,
functions: ::core::option::Option::None,
max_boost: ::core::option::Option::None,
min_score: ::core::option::Option::None,
query: ::core::option::Option::None,
score_mode: ::core::option::Option::None,
}
}
}
impl FunctionScoreQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn boost_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::FunctionBoostMode>,
) -> Self {
self.boost_mode = ::core::option::Option::Some(value.into());
self
}
pub fn functions(
mut self,
value: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
) -> Self {
self.functions = ::core::option::Option::Some(value.into());
self
}
pub fn max_boost(mut self, value: f64) -> Self {
self.max_boost = ::core::option::Option::Some(value.into());
self
}
pub fn min_score(mut self, value: f64) -> Self {
self.min_score = ::core::option::Option::Some(value.into());
self
}
pub fn query(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
) -> Self {
self.query = ::core::option::Option::Some(value.into());
self
}
pub fn score_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::FunctionScoreMode>,
) -> Self {
self.score_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "FunctionScoreQuery")]
struct FunctionScoreQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost_mode: ::core::option::Option<crate::query_dsl::FunctionBoostMode>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
functions: ::core::option::Option<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
max_boost: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
min_score: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
query: ::core::option::Option<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
score_mode: ::core::option::Option<crate::query_dsl::FunctionScoreMode>,
}
impl ::serde::Serialize for FunctionScoreQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.functions,
self.boost.is_none()
&& self.name.is_none()
&& self.boost_mode.is_none()
&& self.max_boost.is_none()
&& self.min_score.is_none()
&& self.query.is_none()
&& self.score_mode.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
FunctionScoreQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FunctionScoreQuery {
type Short = ::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>;
fn from_short(short: ::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
boost_mode: ::core::option::Option::None,
functions: ::core::option::Option::Some(short),
max_boost: ::core::option::Option::None,
min_score: ::core::option::Option::None,
query: ::core::option::Option::None,
score_mode: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
FunctionScoreQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for FunctionScoreQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FuzzyQueryValue {
String(::std::string::String),
Double(f64),
Bool(bool),
}
impl ::serde::Serialize for FuzzyQueryValue {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::String(value) => ::serde::Serialize::serialize(value, serializer),
Self::Double(value) => ::serde::Serialize::serialize(value, serializer),
Self::Bool(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for FuzzyQueryValue {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Shape;
impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
type Value = FuzzyQueryValue;
const EXPECTING: &'static str = "FuzzyQueryValue: boolean or number or string";
fn visit<V__: ::serde::Deserializer<'de>>(
self,
kind: ::oxsearch_core::__private::Kind,
value: V__,
) -> ::core::result::Result<Self::Value, V__::Error> {
match kind {
::oxsearch_core::__private::Kind::Bool => {
<bool as ::serde::Deserialize>::deserialize(value)
.map(FuzzyQueryValue::Bool)
}
::oxsearch_core::__private::Kind::Number => {
<f64 as ::serde::Deserialize>::deserialize(value)
.map(FuzzyQueryValue::Double)
}
::oxsearch_core::__private::Kind::String => {
<::std::string::String as ::serde::Deserialize>::deserialize(value)
.map(FuzzyQueryValue::String)
}
_ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
format_args!("FuzzyQueryValue can't be {kind:?}"),
)),
}
}
}
::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
}
}
impl ::core::convert::From<::std::string::String> for FuzzyQueryValue {
fn from(value: ::std::string::String) -> Self {
Self::String(value)
}
}
impl ::core::convert::From<f64> for FuzzyQueryValue {
fn from(value: f64) -> Self {
Self::Double(value)
}
}
impl ::core::convert::From<bool> for FuzzyQueryValue {
fn from(value: bool) -> Self {
Self::Bool(value)
}
}
impl ::core::convert::From<&str> for FuzzyQueryValue {
fn from(value: &str) -> Self {
Self::String(::std::borrow::ToOwned::to_owned(value))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct FuzzyQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub max_expansions: ::core::option::Option<i32>,
pub prefix_length: ::core::option::Option<i32>,
pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
pub transpositions: ::core::option::Option<bool>,
pub fuzziness: ::core::option::Option<crate::Fuzziness>,
pub value: ::core::option::Option<crate::query_dsl::FuzzyQueryValue>,
}
impl FuzzyQuery {
pub fn new(value: impl ::core::convert::Into<crate::query_dsl::FuzzyQueryValue>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
transpositions: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
value: ::core::option::Option::Some(value.into()),
}
}
}
impl FuzzyQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn max_expansions(mut self, value: i32) -> Self {
self.max_expansions = ::core::option::Option::Some(value.into());
self
}
pub fn prefix_length(mut self, value: i32) -> Self {
self.prefix_length = ::core::option::Option::Some(value.into());
self
}
pub fn rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn transpositions(mut self, value: bool) -> Self {
self.transpositions = ::core::option::Option::Some(value.into());
self
}
pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
self.fuzziness = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "FuzzyQuery")]
struct FuzzyQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
max_expansions: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
prefix_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
transpositions: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
fuzziness: ::core::option::Option<crate::Fuzziness>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
value: ::core::option::Option<crate::query_dsl::FuzzyQueryValue>,
}
impl ::serde::Serialize for FuzzyQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.value,
self.boost.is_none()
&& self.name.is_none()
&& self.max_expansions.is_none()
&& self.prefix_length.is_none()
&& self.rewrite.is_none()
&& self.transpositions.is_none()
&& self.fuzziness.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
FuzzyQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FuzzyQuery {
type Short = crate::query_dsl::FuzzyQueryValue;
fn from_short(short: crate::query_dsl::FuzzyQueryValue) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
transpositions: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
value: ::core::option::Option::Some(short),
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
FuzzyQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for FuzzyQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "GeoBoundingBoxQueryRepr", into = "GeoBoundingBoxQueryRepr")]
#[non_exhaustive]
pub struct GeoBoundingBoxQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub r#type: ::core::option::Option<crate::query_dsl::GeoExecution>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
pub field: crate::Field,
pub bounding_box: crate::GeoBounds,
}
impl GeoBoundingBoxQuery {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
bounding_box: impl ::core::convert::Into<crate::GeoBounds>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
r#type: ::core::option::Option::None,
validation_method: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
field: field.into(),
bounding_box: bounding_box.into(),
}
}
}
impl GeoBoundingBoxQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn r#type(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::GeoExecution>,
) -> Self {
self.r#type = ::core::option::Option::Some(value.into());
self
}
pub fn validation_method(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
) -> Self {
self.validation_method = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct GeoBoundingBoxQueryRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
r#type: ::core::option::Option<crate::query_dsl::GeoExecution>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
ignore_unmapped: ::core::option::Option<bool>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::GeoBounds>,
}
impl ::core::convert::TryFrom<GeoBoundingBoxQueryRepr> for GeoBoundingBoxQuery {
type Error = ::std::string::String;
fn try_from(repr: GeoBoundingBoxQueryRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, bounding_box)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
boost: repr.boost,
name: repr.name,
r#type: repr.r#type,
validation_method: repr.validation_method,
ignore_unmapped: repr.ignore_unmapped,
field,
bounding_box,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"GeoBoundingBoxQuery needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<GeoBoundingBoxQuery> for GeoBoundingBoxQueryRepr {
fn from(value: GeoBoundingBoxQuery) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.bounding_box);
Self {
boost: value.boost,
name: value.name,
r#type: value.r#type,
validation_method: value.validation_method,
ignore_unmapped: value.ignore_unmapped,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "GeoDecayFunctionRepr", into = "GeoDecayFunctionRepr")]
#[non_exhaustive]
pub struct GeoDecayFunction {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
pub field: crate::Field,
pub placement: crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
}
impl GeoDecayFunction {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
placement: impl ::core::convert::Into<
crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
>,
) -> Self {
Self {
multi_value_mode: ::core::option::Option::None,
field: field.into(),
placement: placement.into(),
}
}
}
impl GeoDecayFunction {
pub fn multi_value_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
) -> Self {
self.multi_value_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct GeoDecayFunctionRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<
crate::Field,
crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
>,
}
impl ::core::convert::TryFrom<GeoDecayFunctionRepr> for GeoDecayFunction {
type Error = ::std::string::String;
fn try_from(repr: GeoDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
multi_value_mode: repr.multi_value_mode,
field,
placement,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"GeoDecayFunction needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<GeoDecayFunction> for GeoDecayFunctionRepr {
fn from(value: GeoDecayFunction) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.placement);
Self {
multi_value_mode: value.multi_value_mode,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct GeoDistanceFeatureQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub origin: ::core::option::Option<crate::GeoLocation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pivot: ::core::option::Option<crate::Distance>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
}
impl GeoDistanceFeatureQuery {
pub fn new(
origin: impl ::core::convert::Into<crate::GeoLocation>,
pivot: impl ::core::convert::Into<crate::Distance>,
field: impl ::core::convert::Into<crate::Field>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
origin: ::core::option::Option::Some(origin.into()),
pivot: ::core::option::Option::Some(pivot.into()),
field: ::core::option::Option::Some(field.into()),
}
}
}
impl GeoDistanceFeatureQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "GeoDistanceQueryRepr", into = "GeoDistanceQueryRepr")]
#[non_exhaustive]
pub struct GeoDistanceQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub distance: ::core::option::Option<crate::Distance>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub distance_type: ::core::option::Option<crate::GeoDistanceType>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
pub field: crate::Field,
pub location: crate::GeoLocation,
}
impl GeoDistanceQuery {
pub fn new(
distance: impl ::core::convert::Into<crate::Distance>,
field: impl ::core::convert::Into<crate::Field>,
location: impl ::core::convert::Into<crate::GeoLocation>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
distance: ::core::option::Option::Some(distance.into()),
distance_type: ::core::option::Option::None,
validation_method: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
field: field.into(),
location: location.into(),
}
}
}
impl GeoDistanceQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn distance_type(
mut self,
value: impl ::core::convert::Into<crate::GeoDistanceType>,
) -> Self {
self.distance_type = ::core::option::Option::Some(value.into());
self
}
pub fn validation_method(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
) -> Self {
self.validation_method = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct GeoDistanceQueryRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
distance: ::core::option::Option<crate::Distance>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
distance_type: ::core::option::Option<crate::GeoDistanceType>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
ignore_unmapped: ::core::option::Option<bool>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::GeoLocation>,
}
impl ::core::convert::TryFrom<GeoDistanceQueryRepr> for GeoDistanceQuery {
type Error = ::std::string::String;
fn try_from(repr: GeoDistanceQueryRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, location)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
boost: repr.boost,
name: repr.name,
distance: repr.distance,
distance_type: repr.distance_type,
validation_method: repr.validation_method,
ignore_unmapped: repr.ignore_unmapped,
field,
location,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"GeoDistanceQuery needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<GeoDistanceQuery> for GeoDistanceQueryRepr {
fn from(value: GeoDistanceQuery) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.location);
Self {
boost: value.boost,
name: value.name,
distance: value.distance,
distance_type: value.distance_type,
validation_method: value.validation_method,
ignore_unmapped: value.ignore_unmapped,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum GeoExecution {
Memory,
Indexed,
Raw(::std::string::String),
}
impl GeoExecution {
pub fn as_str(&self) -> &str {
match self {
Self::Memory => "memory",
Self::Indexed => "indexed",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"memory" => ::core::option::Option::Some(Self::Memory),
"indexed" => ::core::option::Option::Some(Self::Indexed),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for GeoExecution {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for GeoExecution {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(deserializer, "GeoExecution", |value| {
Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
})
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum GeoGridQueryVariant {
Geotile(crate::GeoTile),
Geohash(crate::GeoHash),
Geohex(crate::GeoHexCell),
Raw(::serde_json::Value),
}
impl GeoGridQueryVariant {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::Geotile(value) => map.serialize_entry("geotile", value),
Self::Geohash(value) => map.serialize_entry("geohash", value),
Self::Geohex(value) => map.serialize_entry("geohex", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for GeoGridQueryVariant {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Geotile(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geotile", value)
}
Self::Geohash(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geohash", value)
}
Self::Geohex(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geohex", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for GeoGridQueryVariant {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for GeoGridQueryVariant {
const NAME: &'static str = "GeoGridQueryVariant";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"geotile" => Self::Geotile(map.next_value()?),
"geohash" => Self::Geohash(map.next_value()?),
"geohex" => Self::Geohex(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct GeoGridQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub variant: ::core::option::Option<crate::query_dsl::GeoGridQueryVariant>,
}
impl GeoGridQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
variant: ::core::option::Option::None,
}
}
}
impl GeoGridQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn variant(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::GeoGridQueryVariant>,
) -> Self {
self.variant = ::core::option::Option::Some(value.into());
self
}
}
impl ::serde::Serialize for GeoGridQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
use ::serde::ser::SerializeMap as _;
let mut map = serializer.serialize_map(::core::option::Option::None)?;
if let ::core::option::Option::Some(value) = &self.boost {
map.serialize_entry("boost", value)?;
}
if let ::core::option::Option::Some(value) = &self.name {
map.serialize_entry("_name", value)?;
}
if let ::core::option::Option::Some(variant) = &self.variant {
variant.serialize_entry(&mut map)?;
}
map.end()
}
}
impl<'de> ::serde::Deserialize<'de> for GeoGridQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Fields;
impl<'de> ::serde::de::Visitor<'de> for Fields {
type Value = GeoGridQuery;
fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.write_str("a GeoGridQuery object")
}
fn visit_map<A__: ::serde::de::MapAccess<'de>>(
self,
mut map: A__,
) -> ::core::result::Result<GeoGridQuery, A__::Error> {
let mut boost = ::core::option::Option::None;
let mut name = ::core::option::Option::None;
let mut variant__ = ::core::option::Option::None;
while let ::core::option::Option::Some(key) =
map.next_key::<::std::string::String>()?
{
match key.as_str() {
"boost" => boost = ::core::option::Option::Some(map.next_value()?),
"_name" => name = ::core::option::Option::Some(map.next_value()?),
_ => {
if variant__.is_some() {
return ::core::result::Result::Err(
::oxsearch_core::__private::two_variants("GeoGridQuery", &key),
);
}
variant__ = ::core::option::Option::Some(
<GeoGridQueryVariant as ::oxsearch_core::__private::Container<
'de,
>>::variant(&key, &mut map)?,
);
}
}
}
::core::result::Result::Ok(GeoGridQuery {
boost,
name,
variant: variant__,
})
}
}
deserializer.deserialize_map(Fields)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct GeoPolygonPoints {
#[serde(default = "::core::default::Default::default")]
pub points: ::std::vec::Vec<crate::GeoLocation>,
}
impl GeoPolygonPoints {
pub fn new(points: impl ::core::convert::Into<::std::vec::Vec<crate::GeoLocation>>) -> Self {
Self {
points: points.into(),
}
}
}
impl GeoPolygonPoints {}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "GeoPolygonQueryRepr", into = "GeoPolygonQueryRepr")]
#[non_exhaustive]
pub struct GeoPolygonQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
pub field: crate::Field,
pub polygon: crate::query_dsl::GeoPolygonPoints,
}
impl GeoPolygonQuery {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
polygon: impl ::core::convert::Into<crate::query_dsl::GeoPolygonPoints>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
validation_method: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
field: field.into(),
polygon: polygon.into(),
}
}
}
impl GeoPolygonQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn validation_method(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
) -> Self {
self.validation_method = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct GeoPolygonQueryRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
ignore_unmapped: ::core::option::Option<bool>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::GeoPolygonPoints>,
}
impl ::core::convert::TryFrom<GeoPolygonQueryRepr> for GeoPolygonQuery {
type Error = ::std::string::String;
fn try_from(repr: GeoPolygonQueryRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, polygon)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
boost: repr.boost,
name: repr.name,
validation_method: repr.validation_method,
ignore_unmapped: repr.ignore_unmapped,
field,
polygon,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"GeoPolygonQuery needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<GeoPolygonQuery> for GeoPolygonQueryRepr {
fn from(value: GeoPolygonQuery) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.polygon);
Self {
boost: value.boost,
name: value.name,
validation_method: value.validation_method,
ignore_unmapped: value.ignore_unmapped,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct GeoShapeFieldQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub shape: ::core::option::Option<crate::GeoShape>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub indexed_shape: ::core::option::Option<crate::query_dsl::FieldLookup>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::GeoShapeRelation>,
}
impl GeoShapeFieldQuery {
pub fn new() -> Self {
Self {
shape: ::core::option::Option::None,
indexed_shape: ::core::option::Option::None,
relation: ::core::option::Option::None,
}
}
}
impl GeoShapeFieldQuery {
pub fn shape(mut self, value: impl ::core::convert::Into<crate::GeoShape>) -> Self {
self.shape = ::core::option::Option::Some(value.into());
self
}
pub fn indexed_shape(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::FieldLookup>,
) -> Self {
self.indexed_shape = ::core::option::Option::Some(value.into());
self
}
pub fn relation(mut self, value: impl ::core::convert::Into<crate::GeoShapeRelation>) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "GeoShapeQueryRepr", into = "GeoShapeQueryRepr")]
#[non_exhaustive]
pub struct GeoShapeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
pub field: crate::Field,
pub shape: crate::query_dsl::GeoShapeFieldQuery,
}
impl GeoShapeQuery {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
shape: impl ::core::convert::Into<crate::query_dsl::GeoShapeFieldQuery>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
field: field.into(),
shape: shape.into(),
}
}
}
impl GeoShapeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct GeoShapeQueryRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
ignore_unmapped: ::core::option::Option<bool>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::GeoShapeFieldQuery>,
}
impl ::core::convert::TryFrom<GeoShapeQueryRepr> for GeoShapeQuery {
type Error = ::std::string::String;
fn try_from(repr: GeoShapeQueryRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, shape)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
boost: repr.boost,
name: repr.name,
ignore_unmapped: repr.ignore_unmapped,
field,
shape,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"GeoShapeQuery needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<GeoShapeQuery> for GeoShapeQueryRepr {
fn from(value: GeoShapeQuery) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.shape);
Self {
boost: value.boost,
name: value.name,
ignore_unmapped: value.ignore_unmapped,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum GeoValidationMethod {
Coerce,
IgnoreMalformed,
Strict,
Raw(::std::string::String),
}
impl GeoValidationMethod {
pub fn as_str(&self) -> &str {
match self {
Self::Coerce => "coerce",
Self::IgnoreMalformed => "ignore_malformed",
Self::Strict => "strict",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"coerce" => ::core::option::Option::Some(Self::Coerce),
"ignore_malformed" => ::core::option::Option::Some(Self::IgnoreMalformed),
"strict" => ::core::option::Option::Some(Self::Strict),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for GeoValidationMethod {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for GeoValidationMethod {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"GeoValidationMethod",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct HasChildQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_children: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub min_children: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub score_mode: ::core::option::Option<crate::query_dsl::ChildScoreMode>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub r#type: ::core::option::Option<crate::RelationName>,
}
impl HasChildQuery {
pub fn new(
query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
r#type: impl ::core::convert::Into<crate::RelationName>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
inner_hits: ::core::option::Option::None,
max_children: ::core::option::Option::None,
min_children: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
score_mode: ::core::option::Option::None,
r#type: ::core::option::Option::Some(r#type.into()),
}
}
}
impl HasChildQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
pub fn inner_hits(
mut self,
value: impl ::core::convert::Into<crate::search::InnerHits>,
) -> Self {
self.inner_hits = ::core::option::Option::Some(value.into());
self
}
pub fn max_children(mut self, value: i32) -> Self {
self.max_children = ::core::option::Option::Some(value.into());
self
}
pub fn min_children(mut self, value: i32) -> Self {
self.min_children = ::core::option::Option::Some(value.into());
self
}
pub fn score_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::ChildScoreMode>,
) -> Self {
self.score_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct HasParentQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub parent_type: ::core::option::Option<crate::RelationName>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub score: ::core::option::Option<bool>,
}
impl HasParentQuery {
pub fn new(
parent_type: impl ::core::convert::Into<crate::RelationName>,
query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
inner_hits: ::core::option::Option::None,
parent_type: ::core::option::Option::Some(parent_type.into()),
query: ::core::option::Option::Some(query.into()),
score: ::core::option::Option::None,
}
}
}
impl HasParentQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
pub fn inner_hits(
mut self,
value: impl ::core::convert::Into<crate::search::InnerHits>,
) -> Self {
self.inner_hits = ::core::option::Option::Some(value.into());
self
}
pub fn score(mut self, value: bool) -> Self {
self.score = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IdsQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub values: ::core::option::Option<crate::Ids>,
}
impl IdsQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
values: ::core::option::Option::None,
}
}
}
impl IdsQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn values(mut self, value: impl ::core::convert::Into<crate::Ids>) -> Self {
self.values = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsAllOf {
#[serde(default = "::core::default::Default::default")]
pub intervals: ::std::vec::Vec<crate::query_dsl::IntervalsContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_gaps: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ordered: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
}
impl IntervalsAllOf {
pub fn new(
intervals: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::IntervalsContainer>>,
) -> Self {
Self {
intervals: intervals.into(),
max_gaps: ::core::option::Option::None,
ordered: ::core::option::Option::None,
filter: ::core::option::Option::None,
}
}
}
impl IntervalsAllOf {
pub fn max_gaps(mut self, value: i32) -> Self {
self.max_gaps = ::core::option::Option::Some(value.into());
self
}
pub fn ordered(mut self, value: bool) -> Self {
self.ordered = ::core::option::Option::Some(value.into());
self
}
pub fn filter(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
) -> Self {
self.filter = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsAnyOf {
#[serde(default = "::core::default::Default::default")]
pub intervals: ::std::vec::Vec<crate::query_dsl::IntervalsContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
}
impl IntervalsAnyOf {
pub fn new(
intervals: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::IntervalsContainer>>,
) -> Self {
Self {
intervals: intervals.into(),
filter: ::core::option::Option::None,
}
}
}
impl IntervalsAnyOf {
pub fn filter(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
) -> Self {
self.filter = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IntervalsContainer {
AllOf(::std::boxed::Box<crate::query_dsl::IntervalsAllOf>),
AnyOf(::std::boxed::Box<crate::query_dsl::IntervalsAnyOf>),
Fuzzy(crate::query_dsl::IntervalsFuzzy),
Match(::std::boxed::Box<crate::query_dsl::IntervalsMatch>),
Prefix(crate::query_dsl::IntervalsPrefix),
Range(crate::query_dsl::IntervalsRange),
Regexp(crate::query_dsl::IntervalsRegexp),
Wildcard(crate::query_dsl::IntervalsWildcard),
Raw(::serde_json::Value),
}
impl IntervalsContainer {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::AllOf(value) => map.serialize_entry("all_of", value),
Self::AnyOf(value) => map.serialize_entry("any_of", value),
Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
Self::Match(value) => map.serialize_entry("match", value),
Self::Prefix(value) => map.serialize_entry("prefix", value),
Self::Range(value) => map.serialize_entry("range", value),
Self::Regexp(value) => map.serialize_entry("regexp", value),
Self::Wildcard(value) => map.serialize_entry("wildcard", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for IntervalsContainer {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::AllOf(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "all_of", value)
}
Self::AnyOf(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "any_of", value)
}
Self::Fuzzy(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
}
Self::Match(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "match", value)
}
Self::Prefix(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
}
Self::Range(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "range", value)
}
Self::Regexp(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
}
Self::Wildcard(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for IntervalsContainer {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsContainer {
const NAME: &'static str = "IntervalsContainer";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"all_of" => Self::AllOf(map.next_value()?),
"any_of" => Self::AnyOf(map.next_value()?),
"fuzzy" => Self::Fuzzy(map.next_value()?),
"match" => Self::Match(map.next_value()?),
"prefix" => Self::Prefix(map.next_value()?),
"range" => Self::Range(map.next_value()?),
"regexp" => Self::Regexp(map.next_value()?),
"wildcard" => Self::Wildcard(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsAllOf> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsAllOf) -> Self {
Self::AllOf(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsAnyOf> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsAnyOf) -> Self {
Self::AnyOf(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsFuzzy> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsFuzzy) -> Self {
Self::Fuzzy(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsMatch> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsMatch) -> Self {
Self::Match(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsPrefix> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsPrefix) -> Self {
Self::Prefix(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsRange> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsRange) -> Self {
Self::Range(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsRegexp> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsRegexp) -> Self {
Self::Regexp(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsWildcard> for IntervalsContainer {
fn from(value: crate::query_dsl::IntervalsWildcard) -> Self {
Self::Wildcard(value)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IntervalsFilter {
After(crate::query_dsl::IntervalsContainer),
Before(crate::query_dsl::IntervalsContainer),
ContainedBy(crate::query_dsl::IntervalsContainer),
Containing(crate::query_dsl::IntervalsContainer),
NotContainedBy(crate::query_dsl::IntervalsContainer),
NotContaining(crate::query_dsl::IntervalsContainer),
NotOverlapping(crate::query_dsl::IntervalsContainer),
Overlapping(crate::query_dsl::IntervalsContainer),
Script(crate::Script),
Raw(::serde_json::Value),
}
impl IntervalsFilter {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::After(value) => map.serialize_entry("after", value),
Self::Before(value) => map.serialize_entry("before", value),
Self::ContainedBy(value) => map.serialize_entry("contained_by", value),
Self::Containing(value) => map.serialize_entry("containing", value),
Self::NotContainedBy(value) => map.serialize_entry("not_contained_by", value),
Self::NotContaining(value) => map.serialize_entry("not_containing", value),
Self::NotOverlapping(value) => map.serialize_entry("not_overlapping", value),
Self::Overlapping(value) => map.serialize_entry("overlapping", value),
Self::Script(value) => map.serialize_entry("script", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for IntervalsFilter {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::After(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "after", value)
}
Self::Before(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "before", value)
}
Self::ContainedBy(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "contained_by", value)
}
Self::Containing(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "containing", value)
}
Self::NotContainedBy(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "not_contained_by", value)
}
Self::NotContaining(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "not_containing", value)
}
Self::NotOverlapping(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "not_overlapping", value)
}
Self::Overlapping(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "overlapping", value)
}
Self::Script(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "script", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for IntervalsFilter {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsFilter {
const NAME: &'static str = "IntervalsFilter";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"after" => Self::After(map.next_value()?),
"before" => Self::Before(map.next_value()?),
"contained_by" => Self::ContainedBy(map.next_value()?),
"containing" => Self::Containing(map.next_value()?),
"not_contained_by" => Self::NotContainedBy(map.next_value()?),
"not_containing" => Self::NotContaining(map.next_value()?),
"not_overlapping" => Self::NotOverlapping(map.next_value()?),
"overlapping" => Self::Overlapping(map.next_value()?),
"script" => Self::Script(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<crate::Script> for IntervalsFilter {
fn from(value: crate::Script) -> Self {
Self::Script(value)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsFuzzy {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzziness: ::core::option::Option<crate::Fuzziness>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub prefix_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub term: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub transpositions: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub use_field: ::core::option::Option<crate::Field>,
}
impl IntervalsFuzzy {
pub fn new(term: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
analyzer: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
term: ::core::option::Option::Some(term.into()),
transpositions: ::core::option::Option::None,
use_field: ::core::option::Option::None,
}
}
}
impl IntervalsFuzzy {
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
self.fuzziness = ::core::option::Option::Some(value.into());
self
}
pub fn prefix_length(mut self, value: i32) -> Self {
self.prefix_length = ::core::option::Option::Some(value.into());
self
}
pub fn transpositions(mut self, value: bool) -> Self {
self.transpositions = ::core::option::Option::Some(value.into());
self
}
pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.use_field = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsMatch {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_gaps: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ordered: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub use_field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
}
impl IntervalsMatch {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
analyzer: ::core::option::Option::None,
max_gaps: ::core::option::Option::None,
ordered: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
use_field: ::core::option::Option::None,
filter: ::core::option::Option::None,
}
}
}
impl IntervalsMatch {
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn max_gaps(mut self, value: i32) -> Self {
self.max_gaps = ::core::option::Option::Some(value.into());
self
}
pub fn ordered(mut self, value: bool) -> Self {
self.ordered = ::core::option::Option::Some(value.into());
self
}
pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.use_field = ::core::option::Option::Some(value.into());
self
}
pub fn filter(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
) -> Self {
self.filter = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsPrefix {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub prefix: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub use_field: ::core::option::Option<crate::Field>,
}
impl IntervalsPrefix {
pub fn new(prefix: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
analyzer: ::core::option::Option::None,
prefix: ::core::option::Option::Some(prefix.into()),
use_field: ::core::option::Option::None,
}
}
}
impl IntervalsPrefix {
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.use_field = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IntervalsQueryVariant {
AllOf(crate::query_dsl::IntervalsAllOf),
AnyOf(crate::query_dsl::IntervalsAnyOf),
Fuzzy(crate::query_dsl::IntervalsFuzzy),
Match(crate::query_dsl::IntervalsMatch),
Prefix(crate::query_dsl::IntervalsPrefix),
Range(crate::query_dsl::IntervalsRange),
Regexp(crate::query_dsl::IntervalsRegexp),
Wildcard(crate::query_dsl::IntervalsWildcard),
Raw(::serde_json::Value),
}
impl IntervalsQueryVariant {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::AllOf(value) => map.serialize_entry("all_of", value),
Self::AnyOf(value) => map.serialize_entry("any_of", value),
Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
Self::Match(value) => map.serialize_entry("match", value),
Self::Prefix(value) => map.serialize_entry("prefix", value),
Self::Range(value) => map.serialize_entry("range", value),
Self::Regexp(value) => map.serialize_entry("regexp", value),
Self::Wildcard(value) => map.serialize_entry("wildcard", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for IntervalsQueryVariant {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::AllOf(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "all_of", value)
}
Self::AnyOf(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "any_of", value)
}
Self::Fuzzy(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
}
Self::Match(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "match", value)
}
Self::Prefix(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
}
Self::Range(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "range", value)
}
Self::Regexp(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
}
Self::Wildcard(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for IntervalsQueryVariant {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsQueryVariant {
const NAME: &'static str = "IntervalsQueryVariant";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"all_of" => Self::AllOf(map.next_value()?),
"any_of" => Self::AnyOf(map.next_value()?),
"fuzzy" => Self::Fuzzy(map.next_value()?),
"match" => Self::Match(map.next_value()?),
"prefix" => Self::Prefix(map.next_value()?),
"range" => Self::Range(map.next_value()?),
"regexp" => Self::Regexp(map.next_value()?),
"wildcard" => Self::Wildcard(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsAllOf> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsAllOf) -> Self {
Self::AllOf(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsAnyOf> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsAnyOf) -> Self {
Self::AnyOf(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsFuzzy> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsFuzzy) -> Self {
Self::Fuzzy(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsMatch> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsMatch) -> Self {
Self::Match(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsPrefix> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsPrefix) -> Self {
Self::Prefix(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsRange> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsRange) -> Self {
Self::Range(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsRegexp> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsRegexp) -> Self {
Self::Regexp(value)
}
}
impl ::core::convert::From<crate::query_dsl::IntervalsWildcard> for IntervalsQueryVariant {
fn from(value: crate::query_dsl::IntervalsWildcard) -> Self {
Self::Wildcard(value)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct IntervalsQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub variant: ::core::option::Option<crate::query_dsl::IntervalsQueryVariant>,
}
impl IntervalsQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
variant: ::core::option::Option::None,
}
}
}
impl IntervalsQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn variant(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::IntervalsQueryVariant>,
) -> Self {
self.variant = ::core::option::Option::Some(value.into());
self
}
}
impl ::serde::Serialize for IntervalsQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
use ::serde::ser::SerializeMap as _;
let mut map = serializer.serialize_map(::core::option::Option::None)?;
if let ::core::option::Option::Some(value) = &self.boost {
map.serialize_entry("boost", value)?;
}
if let ::core::option::Option::Some(value) = &self.name {
map.serialize_entry("_name", value)?;
}
if let ::core::option::Option::Some(variant) = &self.variant {
variant.serialize_entry(&mut map)?;
}
map.end()
}
}
impl<'de> ::serde::Deserialize<'de> for IntervalsQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Fields;
impl<'de> ::serde::de::Visitor<'de> for Fields {
type Value = IntervalsQuery;
fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.write_str("a IntervalsQuery object")
}
fn visit_map<A__: ::serde::de::MapAccess<'de>>(
self,
mut map: A__,
) -> ::core::result::Result<IntervalsQuery, A__::Error> {
let mut boost = ::core::option::Option::None;
let mut name = ::core::option::Option::None;
let mut variant__ = ::core::option::Option::None;
while let ::core::option::Option::Some(key) =
map.next_key::<::std::string::String>()?
{
match key.as_str() {
"boost" => boost = ::core::option::Option::Some(map.next_value()?),
"_name" => name = ::core::option::Option::Some(map.next_value()?),
_ => {
if variant__.is_some() {
return ::core::result::Result::Err(
::oxsearch_core::__private::two_variants(
"IntervalsQuery",
&key,
),
);
}
variant__ = ::core::option::Option::Some(
<IntervalsQueryVariant as ::oxsearch_core::__private::Container<
'de,
>>::variant(&key, &mut map)?,
);
}
}
}
::core::result::Result::Ok(IntervalsQuery {
boost,
name,
variant: variant__,
})
}
}
deserializer.deserialize_map(Fields)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsRange {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gte: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gt: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lte: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lt: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub use_field: ::core::option::Option<crate::Field>,
}
impl IntervalsRange {
pub fn new() -> Self {
Self {
analyzer: ::core::option::Option::None,
gte: ::core::option::Option::None,
gt: ::core::option::Option::None,
lte: ::core::option::Option::None,
lt: ::core::option::Option::None,
use_field: ::core::option::Option::None,
}
}
}
impl IntervalsRange {
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn gte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.gte = ::core::option::Option::Some(value.into());
self
}
pub fn gt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.gt = ::core::option::Option::Some(value.into());
self
}
pub fn lte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.lte = ::core::option::Option::Some(value.into());
self
}
pub fn lt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.lt = ::core::option::Option::Some(value.into());
self
}
pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.use_field = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsRegexp {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pattern: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub use_field: ::core::option::Option<crate::Field>,
}
impl IntervalsRegexp {
pub fn new(pattern: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
analyzer: ::core::option::Option::None,
pattern: ::core::option::Option::Some(pattern.into()),
use_field: ::core::option::Option::None,
}
}
}
impl IntervalsRegexp {
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.use_field = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct IntervalsWildcard {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pattern: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub use_field: ::core::option::Option<crate::Field>,
}
impl IntervalsWildcard {
pub fn new(pattern: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
analyzer: ::core::option::Option::None,
pattern: ::core::option::Option::Some(pattern.into()),
use_field: ::core::option::Option::None,
}
}
}
impl IntervalsWildcard {
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.use_field = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct KqlQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub case_insensitive: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub default_field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub time_zone: ::core::option::Option<crate::TimeZone>,
}
impl KqlQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
case_insensitive: ::core::option::Option::None,
default_field: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
time_zone: ::core::option::Option::None,
}
}
}
impl KqlQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn case_insensitive(mut self, value: bool) -> Self {
self.case_insensitive = ::core::option::Option::Some(value.into());
self
}
pub fn default_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.default_field = ::core::option::Option::Some(value.into());
self
}
pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
self.time_zone = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Like {
Text(::std::string::String),
Document(crate::query_dsl::LikeDocument),
}
impl ::serde::Serialize for Like {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Text(value) => ::serde::Serialize::serialize(value, serializer),
Self::Document(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for Like {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Shape;
impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
type Value = Like;
const EXPECTING: &'static str = "Like: object or string";
fn visit<V__: ::serde::Deserializer<'de>>(
self,
kind: ::oxsearch_core::__private::Kind,
value: V__,
) -> ::core::result::Result<Self::Value, V__::Error> {
match kind {
::oxsearch_core::__private::Kind::String => {
<::std::string::String as ::serde::Deserialize>::deserialize(value)
.map(Like::Text)
}
::oxsearch_core::__private::Kind::Object => {
<crate::query_dsl::LikeDocument as ::serde::Deserialize>::deserialize(value)
.map(Like::Document)
}
_ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
format_args!("Like can't be {kind:?}"),
)),
}
}
}
::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
}
}
impl ::core::convert::From<::std::string::String> for Like {
fn from(value: ::std::string::String) -> Self {
Self::Text(value)
}
}
impl ::core::convert::From<crate::query_dsl::LikeDocument> for Like {
fn from(value: crate::query_dsl::LikeDocument) -> Self {
Self::Document(value)
}
}
impl ::core::convert::From<&str> for Like {
fn from(value: &str) -> Self {
Self::Text(::std::borrow::ToOwned::to_owned(value))
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct LikeDocument {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub doc: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
#[serde(
rename = "_id",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub id: ::core::option::Option<crate::Id>,
#[serde(
rename = "_index",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub index: ::core::option::Option<crate::IndexName>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub per_field_analyzer:
::core::option::Option<::indexmap::IndexMap<crate::Field, ::std::string::String>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub routing: ::core::option::Option<crate::Routing>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub version: ::core::option::Option<crate::VersionNumber>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub version_type: ::core::option::Option<crate::VersionType>,
}
impl LikeDocument {
pub fn new() -> Self {
Self {
doc: ::core::option::Option::None,
fields: ::core::option::Option::None,
id: ::core::option::Option::None,
index: ::core::option::Option::None,
per_field_analyzer: ::core::option::Option::None,
routing: ::core::option::Option::None,
version: ::core::option::Option::None,
version_type: ::core::option::Option::None,
}
}
}
impl LikeDocument {
pub fn doc(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
self.doc = ::core::option::Option::Some(value.into());
self
}
pub fn fields(
mut self,
value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
) -> Self {
self.fields = ::core::option::Option::Some(value.into());
self
}
pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
self.id = ::core::option::Option::Some(value.into());
self
}
pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
self.index = ::core::option::Option::Some(value.into());
self
}
pub fn per_field_analyzer(
mut self,
value: impl ::core::convert::Into<::indexmap::IndexMap<crate::Field, ::std::string::String>>,
) -> Self {
self.per_field_analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn routing(mut self, value: impl ::core::convert::Into<crate::Routing>) -> Self {
self.routing = ::core::option::Option::Some(value.into());
self
}
pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
self.version = ::core::option::Option::Some(value.into());
self
}
pub fn version_type(mut self, value: impl ::core::convert::Into<crate::VersionType>) -> Self {
self.version_type = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct LongNumberRangeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gt: ::core::option::Option<i64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gte: ::core::option::Option<i64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lt: ::core::option::Option<i64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lte: ::core::option::Option<i64>,
}
impl LongNumberRangeQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
relation: ::core::option::Option::None,
gt: ::core::option::Option::None,
gte: ::core::option::Option::None,
lt: ::core::option::Option::None,
lte: ::core::option::Option::None,
}
}
}
impl LongNumberRangeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn relation(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
pub fn gt(mut self, value: i64) -> Self {
self.gt = ::core::option::Option::Some(value.into());
self
}
pub fn gte(mut self, value: i64) -> Self {
self.gte = ::core::option::Option::Some(value.into());
self
}
pub fn lt(mut self, value: i64) -> Self {
self.lt = ::core::option::Option::Some(value.into());
self
}
pub fn lte(mut self, value: i64) -> Self {
self.lte = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct MatchAllQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
}
impl MatchAllQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
}
}
}
impl MatchAllQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct MatchBoolPrefixQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub analyzer: ::core::option::Option<::std::string::String>,
pub fuzziness: ::core::option::Option<crate::Fuzziness>,
pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
pub fuzzy_transpositions: ::core::option::Option<bool>,
pub max_expansions: ::core::option::Option<i32>,
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
pub operator: ::core::option::Option<crate::query_dsl::Operator>,
pub prefix_length: ::core::option::Option<i32>,
pub query: ::core::option::Option<::std::string::String>,
}
impl MatchBoolPrefixQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
fuzzy_rewrite: ::core::option::Option::None,
fuzzy_transpositions: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
operator: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
}
}
}
impl MatchBoolPrefixQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
self.fuzziness = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
self
}
pub fn max_expansions(mut self, value: i32) -> Self {
self.max_expansions = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::Operator>,
) -> Self {
self.operator = ::core::option::Option::Some(value.into());
self
}
pub fn prefix_length(mut self, value: i32) -> Self {
self.prefix_length = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "MatchBoolPrefixQuery")]
struct MatchBoolPrefixQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
fuzziness: ::core::option::Option<crate::Fuzziness>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
fuzzy_transpositions: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
max_expansions: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
operator: ::core::option::Option<crate::query_dsl::Operator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
prefix_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
query: ::core::option::Option<::std::string::String>,
}
impl ::serde::Serialize for MatchBoolPrefixQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.query,
self.boost.is_none()
&& self.name.is_none()
&& self.analyzer.is_none()
&& self.fuzziness.is_none()
&& self.fuzzy_rewrite.is_none()
&& self.fuzzy_transpositions.is_none()
&& self.max_expansions.is_none()
&& self.minimum_should_match.is_none()
&& self.operator.is_none()
&& self.prefix_length.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
MatchBoolPrefixQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchBoolPrefixQuery {
type Short = ::std::string::String;
fn from_short(short: ::std::string::String) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
fuzzy_rewrite: ::core::option::Option::None,
fuzzy_transpositions: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
operator: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
query: ::core::option::Option::Some(short),
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
MatchBoolPrefixQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for MatchBoolPrefixQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct MatchNoneQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
}
impl MatchNoneQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
}
}
}
impl MatchNoneQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct MatchPhrasePrefixQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub analyzer: ::core::option::Option<::std::string::String>,
pub max_expansions: ::core::option::Option<i32>,
pub query: ::core::option::Option<::std::string::String>,
pub slop: ::core::option::Option<i32>,
pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
}
impl MatchPhrasePrefixQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
slop: ::core::option::Option::None,
zero_terms_query: ::core::option::Option::None,
}
}
}
impl MatchPhrasePrefixQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn max_expansions(mut self, value: i32) -> Self {
self.max_expansions = ::core::option::Option::Some(value.into());
self
}
pub fn slop(mut self, value: i32) -> Self {
self.slop = ::core::option::Option::Some(value.into());
self
}
pub fn zero_terms_query(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
) -> Self {
self.zero_terms_query = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "MatchPhrasePrefixQuery")]
struct MatchPhrasePrefixQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
max_expansions: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
slop: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
}
impl ::serde::Serialize for MatchPhrasePrefixQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.query,
self.boost.is_none()
&& self.name.is_none()
&& self.analyzer.is_none()
&& self.max_expansions.is_none()
&& self.slop.is_none()
&& self.zero_terms_query.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
MatchPhrasePrefixQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchPhrasePrefixQuery {
type Short = ::std::string::String;
fn from_short(short: ::std::string::String) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
query: ::core::option::Option::Some(short),
slop: ::core::option::Option::None,
zero_terms_query: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
MatchPhrasePrefixQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for MatchPhrasePrefixQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct MatchPhraseQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub analyzer: ::core::option::Option<::std::string::String>,
pub query: ::core::option::Option<::std::string::String>,
pub slop: ::core::option::Option<i32>,
pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
}
impl MatchPhraseQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
slop: ::core::option::Option::None,
zero_terms_query: ::core::option::Option::None,
}
}
}
impl MatchPhraseQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn slop(mut self, value: i32) -> Self {
self.slop = ::core::option::Option::Some(value.into());
self
}
pub fn zero_terms_query(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
) -> Self {
self.zero_terms_query = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "MatchPhraseQuery")]
struct MatchPhraseQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
slop: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
}
impl ::serde::Serialize for MatchPhraseQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.query,
self.boost.is_none()
&& self.name.is_none()
&& self.analyzer.is_none()
&& self.slop.is_none()
&& self.zero_terms_query.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
MatchPhraseQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchPhraseQuery {
type Short = ::std::string::String;
fn from_short(short: ::std::string::String) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
query: ::core::option::Option::Some(short),
slop: ::core::option::Option::None,
zero_terms_query: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
MatchPhraseQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for MatchPhraseQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MatchQueryQuery {
String(::std::string::String),
Float(f32),
Bool(bool),
}
impl ::serde::Serialize for MatchQueryQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::String(value) => ::serde::Serialize::serialize(value, serializer),
Self::Float(value) => ::serde::Serialize::serialize(value, serializer),
Self::Bool(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for MatchQueryQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Shape;
impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
type Value = MatchQueryQuery;
const EXPECTING: &'static str = "MatchQueryQuery: boolean or number or string";
fn visit<V__: ::serde::Deserializer<'de>>(
self,
kind: ::oxsearch_core::__private::Kind,
value: V__,
) -> ::core::result::Result<Self::Value, V__::Error> {
match kind {
::oxsearch_core::__private::Kind::Bool => {
<bool as ::serde::Deserialize>::deserialize(value)
.map(MatchQueryQuery::Bool)
}
::oxsearch_core::__private::Kind::Number => {
<f32 as ::serde::Deserialize>::deserialize(value)
.map(MatchQueryQuery::Float)
}
::oxsearch_core::__private::Kind::String => {
<::std::string::String as ::serde::Deserialize>::deserialize(value)
.map(MatchQueryQuery::String)
}
_ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
format_args!("MatchQueryQuery can't be {kind:?}"),
)),
}
}
}
::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
}
}
impl ::core::convert::From<::std::string::String> for MatchQueryQuery {
fn from(value: ::std::string::String) -> Self {
Self::String(value)
}
}
impl ::core::convert::From<f32> for MatchQueryQuery {
fn from(value: f32) -> Self {
Self::Float(value)
}
}
impl ::core::convert::From<bool> for MatchQueryQuery {
fn from(value: bool) -> Self {
Self::Bool(value)
}
}
impl ::core::convert::From<&str> for MatchQueryQuery {
fn from(value: &str) -> Self {
Self::String(::std::borrow::ToOwned::to_owned(value))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct MatchQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub analyzer: ::core::option::Option<::std::string::String>,
pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
pub cutoff_frequency: ::core::option::Option<f64>,
pub fuzziness: ::core::option::Option<crate::Fuzziness>,
pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
pub fuzzy_transpositions: ::core::option::Option<bool>,
pub lenient: ::core::option::Option<bool>,
pub max_expansions: ::core::option::Option<i32>,
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
pub operator: ::core::option::Option<crate::query_dsl::Operator>,
pub prefix_length: ::core::option::Option<i32>,
pub query: ::core::option::Option<crate::query_dsl::MatchQueryQuery>,
pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
}
impl MatchQuery {
pub fn new(query: impl ::core::convert::Into<crate::query_dsl::MatchQueryQuery>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
auto_generate_synonyms_phrase_query: ::core::option::Option::None,
cutoff_frequency: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
fuzzy_rewrite: ::core::option::Option::None,
fuzzy_transpositions: ::core::option::Option::None,
lenient: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
operator: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
zero_terms_query: ::core::option::Option::None,
}
}
}
impl MatchQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
self
}
pub fn cutoff_frequency(mut self, value: f64) -> Self {
self.cutoff_frequency = ::core::option::Option::Some(value.into());
self
}
pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
self.fuzziness = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
self
}
pub fn lenient(mut self, value: bool) -> Self {
self.lenient = ::core::option::Option::Some(value.into());
self
}
pub fn max_expansions(mut self, value: i32) -> Self {
self.max_expansions = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::Operator>,
) -> Self {
self.operator = ::core::option::Option::Some(value.into());
self
}
pub fn prefix_length(mut self, value: i32) -> Self {
self.prefix_length = ::core::option::Option::Some(value.into());
self
}
pub fn zero_terms_query(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
) -> Self {
self.zero_terms_query = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "MatchQuery")]
struct MatchQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
cutoff_frequency: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
fuzziness: ::core::option::Option<crate::Fuzziness>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
fuzzy_transpositions: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
lenient: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
max_expansions: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
operator: ::core::option::Option<crate::query_dsl::Operator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
prefix_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
query: ::core::option::Option<crate::query_dsl::MatchQueryQuery>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
}
impl ::serde::Serialize for MatchQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.query,
self.boost.is_none()
&& self.name.is_none()
&& self.analyzer.is_none()
&& self.auto_generate_synonyms_phrase_query.is_none()
&& self.cutoff_frequency.is_none()
&& self.fuzziness.is_none()
&& self.fuzzy_rewrite.is_none()
&& self.fuzzy_transpositions.is_none()
&& self.lenient.is_none()
&& self.max_expansions.is_none()
&& self.minimum_should_match.is_none()
&& self.operator.is_none()
&& self.prefix_length.is_none()
&& self.zero_terms_query.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
MatchQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchQuery {
type Short = crate::query_dsl::MatchQueryQuery;
fn from_short(short: crate::query_dsl::MatchQueryQuery) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
auto_generate_synonyms_phrase_query: ::core::option::Option::None,
cutoff_frequency: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
fuzzy_rewrite: ::core::option::Option::None,
fuzzy_transpositions: ::core::option::Option::None,
lenient: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
operator: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
query: ::core::option::Option::Some(short),
zero_terms_query: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
MatchQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for MatchQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct MoreLikeThisQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost_terms: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fail_on_unsupported_field: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub include: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub like: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_doc_freq: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_query_terms: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_word_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub min_doc_freq: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub min_term_freq: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub min_word_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub routing: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub stop_words: ::core::option::Option<crate::analysis::StopWords>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub unlike: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub version: ::core::option::Option<crate::VersionNumber>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub version_type: ::core::option::Option<crate::VersionType>,
}
impl MoreLikeThisQuery {
pub fn new(
like: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
boost_terms: ::core::option::Option::None,
fail_on_unsupported_field: ::core::option::Option::None,
fields: ::core::option::Option::None,
include: ::core::option::Option::None,
like: ::core::option::Option::Some(like.into()),
max_doc_freq: ::core::option::Option::None,
max_query_terms: ::core::option::Option::None,
max_word_length: ::core::option::Option::None,
min_doc_freq: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
min_term_freq: ::core::option::Option::None,
min_word_length: ::core::option::Option::None,
routing: ::core::option::Option::None,
stop_words: ::core::option::Option::None,
unlike: ::core::option::Option::None,
version: ::core::option::Option::None,
version_type: ::core::option::Option::None,
}
}
}
impl MoreLikeThisQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn boost_terms(mut self, value: f64) -> Self {
self.boost_terms = ::core::option::Option::Some(value.into());
self
}
pub fn fail_on_unsupported_field(mut self, value: bool) -> Self {
self.fail_on_unsupported_field = ::core::option::Option::Some(value.into());
self
}
pub fn fields(
mut self,
value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
) -> Self {
self.fields = ::core::option::Option::Some(value.into());
self
}
pub fn include(mut self, value: bool) -> Self {
self.include = ::core::option::Option::Some(value.into());
self
}
pub fn max_doc_freq(mut self, value: i32) -> Self {
self.max_doc_freq = ::core::option::Option::Some(value.into());
self
}
pub fn max_query_terms(mut self, value: i32) -> Self {
self.max_query_terms = ::core::option::Option::Some(value.into());
self
}
pub fn max_word_length(mut self, value: i32) -> Self {
self.max_word_length = ::core::option::Option::Some(value.into());
self
}
pub fn min_doc_freq(mut self, value: i32) -> Self {
self.min_doc_freq = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn min_term_freq(mut self, value: i32) -> Self {
self.min_term_freq = ::core::option::Option::Some(value.into());
self
}
pub fn min_word_length(mut self, value: i32) -> Self {
self.min_word_length = ::core::option::Option::Some(value.into());
self
}
pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.routing = ::core::option::Option::Some(value.into());
self
}
pub fn stop_words(
mut self,
value: impl ::core::convert::Into<crate::analysis::StopWords>,
) -> Self {
self.stop_words = ::core::option::Option::Some(value.into());
self
}
pub fn unlike(
mut self,
value: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
) -> Self {
self.unlike = ::core::option::Option::Some(value.into());
self
}
pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
self.version = ::core::option::Option::Some(value.into());
self
}
pub fn version_type(mut self, value: impl ::core::convert::Into<crate::VersionType>) -> Self {
self.version_type = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct MultiMatchQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub cutoff_frequency: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fields: ::core::option::Option<crate::Fields>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzziness: ::core::option::Option<crate::Fuzziness>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_transpositions: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lenient: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_expansions: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub operator: ::core::option::Option<crate::query_dsl::Operator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub prefix_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub slop: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub tie_breaker: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub r#type: ::core::option::Option<crate::query_dsl::TextQueryType>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
}
impl MultiMatchQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
auto_generate_synonyms_phrase_query: ::core::option::Option::None,
cutoff_frequency: ::core::option::Option::None,
fields: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
fuzzy_rewrite: ::core::option::Option::None,
fuzzy_transpositions: ::core::option::Option::None,
lenient: ::core::option::Option::None,
max_expansions: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
operator: ::core::option::Option::None,
prefix_length: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
slop: ::core::option::Option::None,
tie_breaker: ::core::option::Option::None,
r#type: ::core::option::Option::None,
zero_terms_query: ::core::option::Option::None,
}
}
}
impl MultiMatchQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
self
}
pub fn cutoff_frequency(mut self, value: f64) -> Self {
self.cutoff_frequency = ::core::option::Option::Some(value.into());
self
}
pub fn fields(mut self, value: impl ::core::convert::Into<crate::Fields>) -> Self {
self.fields = ::core::option::Option::Some(value.into());
self
}
pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
self.fuzziness = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
self
}
pub fn lenient(mut self, value: bool) -> Self {
self.lenient = ::core::option::Option::Some(value.into());
self
}
pub fn max_expansions(mut self, value: i32) -> Self {
self.max_expansions = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::Operator>,
) -> Self {
self.operator = ::core::option::Option::Some(value.into());
self
}
pub fn prefix_length(mut self, value: i32) -> Self {
self.prefix_length = ::core::option::Option::Some(value.into());
self
}
pub fn slop(mut self, value: i32) -> Self {
self.slop = ::core::option::Option::Some(value.into());
self
}
pub fn tie_breaker(mut self, value: f64) -> Self {
self.tie_breaker = ::core::option::Option::Some(value.into());
self
}
pub fn r#type(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::TextQueryType>,
) -> Self {
self.r#type = ::core::option::Option::Some(value.into());
self
}
pub fn zero_terms_query(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
) -> Self {
self.zero_terms_query = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum MultiValueMode {
Min,
Max,
Avg,
Sum,
Raw(::std::string::String),
}
impl MultiValueMode {
pub fn as_str(&self) -> &str {
match self {
Self::Min => "min",
Self::Max => "max",
Self::Avg => "avg",
Self::Sum => "sum",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"min" => ::core::option::Option::Some(Self::Min),
"max" => ::core::option::Option::Some(Self::Max),
"avg" => ::core::option::Option::Some(Self::Avg),
"sum" => ::core::option::Option::Some(Self::Sum),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for MultiValueMode {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for MultiValueMode {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"MultiValueMode",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct NestedQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub path: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub score_mode: ::core::option::Option<crate::query_dsl::ChildScoreMode>,
}
impl NestedQuery {
pub fn new(
path: impl ::core::convert::Into<crate::Field>,
query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
inner_hits: ::core::option::Option::None,
path: ::core::option::Option::Some(path.into()),
query: ::core::option::Option::Some(query.into()),
score_mode: ::core::option::Option::None,
}
}
}
impl NestedQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
pub fn inner_hits(
mut self,
value: impl ::core::convert::Into<crate::search::InnerHits>,
) -> Self {
self.inner_hits = ::core::option::Option::Some(value.into());
self
}
pub fn score_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::ChildScoreMode>,
) -> Self {
self.score_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct NumberRangeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gt: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gte: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lt: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lte: ::core::option::Option<f64>,
}
impl NumberRangeQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
relation: ::core::option::Option::None,
gt: ::core::option::Option::None,
gte: ::core::option::Option::None,
lt: ::core::option::Option::None,
lte: ::core::option::Option::None,
}
}
}
impl NumberRangeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn relation(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
pub fn gt(mut self, value: f64) -> Self {
self.gt = ::core::option::Option::Some(value.into());
self
}
pub fn gte(mut self, value: f64) -> Self {
self.gte = ::core::option::Option::Some(value.into());
self
}
pub fn lt(mut self, value: f64) -> Self {
self.lt = ::core::option::Option::Some(value.into());
self
}
pub fn lte(mut self, value: f64) -> Self {
self.lte = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(
try_from = "NumericDecayFunctionRepr",
into = "NumericDecayFunctionRepr"
)]
#[non_exhaustive]
pub struct NumericDecayFunction {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
pub field: crate::Field,
pub placement: crate::query_dsl::DecayPlacement<f64, f64>,
}
impl NumericDecayFunction {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
placement: impl ::core::convert::Into<crate::query_dsl::DecayPlacement<f64, f64>>,
) -> Self {
Self {
multi_value_mode: ::core::option::Option::None,
field: field.into(),
placement: placement.into(),
}
}
}
impl NumericDecayFunction {
pub fn multi_value_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
) -> Self {
self.multi_value_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct NumericDecayFunctionRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::DecayPlacement<f64, f64>>,
}
impl ::core::convert::TryFrom<NumericDecayFunctionRepr> for NumericDecayFunction {
type Error = ::std::string::String;
fn try_from(repr: NumericDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
multi_value_mode: repr.multi_value_mode,
field,
placement,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"NumericDecayFunction needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<NumericDecayFunction> for NumericDecayFunctionRepr {
fn from(value: NumericDecayFunction) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.placement);
Self {
multi_value_mode: value.multi_value_mode,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Operator {
And,
Or,
Raw(::std::string::String),
}
impl Operator {
pub fn as_str(&self) -> &str {
match self {
Self::And => "and",
Self::Or => "or",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"and" | "AND" => ::core::option::Option::Some(Self::And),
"or" | "OR" => ::core::option::Option::Some(Self::Or),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for Operator {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for Operator {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(deserializer, "Operator", |value| {
Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
})
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ParentIdQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub id: ::core::option::Option<crate::Id>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub r#type: ::core::option::Option<crate::RelationName>,
}
impl ParentIdQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
id: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
r#type: ::core::option::Option::None,
}
}
}
impl ParentIdQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
self.id = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
pub fn r#type(mut self, value: impl ::core::convert::Into<crate::RelationName>) -> Self {
self.r#type = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct PercolateQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub _name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub document: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub documents: ::core::option::Option<::std::vec::Vec<::serde_json::Value>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub id: ::core::option::Option<crate::Id>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub index: ::core::option::Option<crate::IndexName>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub preference: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub routing: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub version: ::core::option::Option<crate::VersionNumber>,
}
impl PercolateQuery {
pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
Self {
boost: ::core::option::Option::None,
_name: ::core::option::Option::None,
document: ::core::option::Option::None,
documents: ::core::option::Option::None,
field: ::core::option::Option::Some(field.into()),
id: ::core::option::Option::None,
index: ::core::option::Option::None,
name: ::core::option::Option::None,
preference: ::core::option::Option::None,
routing: ::core::option::Option::None,
version: ::core::option::Option::None,
}
}
}
impl PercolateQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn _name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self._name = ::core::option::Option::Some(value.into());
self
}
pub fn document(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
self.document = ::core::option::Option::Some(value.into());
self
}
pub fn documents(
mut self,
value: impl ::core::convert::Into<::std::vec::Vec<::serde_json::Value>>,
) -> Self {
self.documents = ::core::option::Option::Some(value.into());
self
}
pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
self.id = ::core::option::Option::Some(value.into());
self
}
pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
self.index = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn preference(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.preference = ::core::option::Option::Some(value.into());
self
}
pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.routing = ::core::option::Option::Some(value.into());
self
}
pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
self.version = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct PinnedDoc {
#[serde(
rename = "_id",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub id: ::core::option::Option<crate::Id>,
#[serde(
rename = "_index",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub index: ::core::option::Option<crate::IndexName>,
}
impl PinnedDoc {
pub fn new(id: impl ::core::convert::Into<crate::Id>) -> Self {
Self {
id: ::core::option::Option::Some(id.into()),
index: ::core::option::Option::None,
}
}
}
impl PinnedDoc {
pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
self.index = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PinnedQueryVariant {
Ids(::std::vec::Vec<crate::Id>),
Docs(::std::vec::Vec<crate::query_dsl::PinnedDoc>),
Raw(::serde_json::Value),
}
impl PinnedQueryVariant {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::Ids(value) => map.serialize_entry("ids", value),
Self::Docs(value) => map.serialize_entry("docs", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for PinnedQueryVariant {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Ids(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "ids", value)
}
Self::Docs(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "docs", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for PinnedQueryVariant {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for PinnedQueryVariant {
const NAME: &'static str = "PinnedQueryVariant";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"ids" => Self::Ids(map.next_value()?),
"docs" => Self::Docs(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<::std::vec::Vec<crate::Id>> for PinnedQueryVariant {
fn from(value: ::std::vec::Vec<crate::Id>) -> Self {
Self::Ids(value)
}
}
impl ::core::convert::From<::std::vec::Vec<crate::query_dsl::PinnedDoc>> for PinnedQueryVariant {
fn from(value: ::std::vec::Vec<crate::query_dsl::PinnedDoc>) -> Self {
Self::Docs(value)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct PinnedQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub organic: ::core::option::Option<crate::query_dsl::QueryContainer>,
pub variant: ::core::option::Option<crate::query_dsl::PinnedQueryVariant>,
}
impl PinnedQuery {
pub fn new(organic: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
organic: ::core::option::Option::Some(organic.into()),
variant: ::core::option::Option::None,
}
}
}
impl PinnedQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn variant(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::PinnedQueryVariant>,
) -> Self {
self.variant = ::core::option::Option::Some(value.into());
self
}
}
impl ::serde::Serialize for PinnedQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
use ::serde::ser::SerializeMap as _;
let mut map = serializer.serialize_map(::core::option::Option::None)?;
if let ::core::option::Option::Some(value) = &self.boost {
map.serialize_entry("boost", value)?;
}
if let ::core::option::Option::Some(value) = &self.name {
map.serialize_entry("_name", value)?;
}
if let ::core::option::Option::Some(value) = &self.organic {
map.serialize_entry("organic", value)?;
}
if let ::core::option::Option::Some(variant) = &self.variant {
variant.serialize_entry(&mut map)?;
}
map.end()
}
}
impl<'de> ::serde::Deserialize<'de> for PinnedQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Fields;
impl<'de> ::serde::de::Visitor<'de> for Fields {
type Value = PinnedQuery;
fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.write_str("a PinnedQuery object")
}
fn visit_map<A__: ::serde::de::MapAccess<'de>>(
self,
mut map: A__,
) -> ::core::result::Result<PinnedQuery, A__::Error> {
let mut boost = ::core::option::Option::None;
let mut name = ::core::option::Option::None;
let mut organic = ::core::option::Option::None;
let mut variant__ = ::core::option::Option::None;
while let ::core::option::Option::Some(key) =
map.next_key::<::std::string::String>()?
{
match key.as_str() {
"boost" => boost = ::core::option::Option::Some(map.next_value()?),
"_name" => name = ::core::option::Option::Some(map.next_value()?),
"organic" => organic = ::core::option::Option::Some(map.next_value()?),
_ => {
if variant__.is_some() {
return ::core::result::Result::Err(
::oxsearch_core::__private::two_variants("PinnedQuery", &key),
);
}
variant__ = ::core::option::Option::Some(
<PinnedQueryVariant as ::oxsearch_core::__private::Container<
'de,
>>::variant(&key, &mut map)?,
);
}
}
}
::core::result::Result::Ok(PinnedQuery {
boost,
name,
organic,
variant: variant__,
})
}
}
deserializer.deserialize_map(Fields)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct PrefixQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
pub value: ::core::option::Option<::std::string::String>,
pub case_insensitive: ::core::option::Option<bool>,
}
impl PrefixQuery {
pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
value: ::core::option::Option::Some(value.into()),
case_insensitive: ::core::option::Option::None,
}
}
}
impl PrefixQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn case_insensitive(mut self, value: bool) -> Self {
self.case_insensitive = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "PrefixQuery")]
struct PrefixQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
value: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
case_insensitive: ::core::option::Option<bool>,
}
impl ::serde::Serialize for PrefixQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.value,
self.boost.is_none()
&& self.name.is_none()
&& self.rewrite.is_none()
&& self.case_insensitive.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
PrefixQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for PrefixQuery {
type Short = ::std::string::String;
fn from_short(short: ::std::string::String) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
value: ::core::option::Option::Some(short),
case_insensitive: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
PrefixQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for PrefixQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct QueryBase {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
}
impl QueryBase {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
}
}
}
impl QueryBase {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QueryContainer {
Bool(::std::boxed::Box<crate::query_dsl::BoolQuery>),
Boosting(::std::boxed::Box<crate::query_dsl::BoostingQuery>),
Common(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>),
CombinedFields(crate::query_dsl::CombinedFieldsQuery),
ConstantScore(::std::boxed::Box<crate::query_dsl::ConstantScoreQuery>),
DisMax(crate::query_dsl::DisMaxQuery),
DistanceFeature(crate::query_dsl::DistanceFeatureQuery),
Exists(crate::query_dsl::ExistsQuery),
FunctionScore(::std::boxed::Box<crate::query_dsl::FunctionScoreQuery>),
Fuzzy(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>),
GeoBoundingBox(crate::query_dsl::GeoBoundingBoxQuery),
GeoDistance(crate::query_dsl::GeoDistanceQuery),
GeoGrid(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>),
GeoPolygon(crate::query_dsl::GeoPolygonQuery),
GeoShape(crate::query_dsl::GeoShapeQuery),
HasChild(::std::boxed::Box<crate::query_dsl::HasChildQuery>),
HasParent(::std::boxed::Box<crate::query_dsl::HasParentQuery>),
Ids(crate::query_dsl::IdsQuery),
Intervals(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>),
Knn(::std::boxed::Box<crate::KnnQuery>),
Kql(crate::query_dsl::KqlQuery),
Match(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>),
MatchAll(crate::query_dsl::MatchAllQuery),
MatchBoolPrefix(
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchBoolPrefixQuery>,
),
MatchNone(crate::query_dsl::MatchNoneQuery),
MatchPhrase(
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
),
MatchPhrasePrefix(
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhrasePrefixQuery>,
),
MoreLikeThis(crate::query_dsl::MoreLikeThisQuery),
MultiMatch(crate::query_dsl::MultiMatchQuery),
Nested(::std::boxed::Box<crate::query_dsl::NestedQuery>),
ParentId(crate::query_dsl::ParentIdQuery),
Percolate(crate::query_dsl::PercolateQuery),
Pinned(::std::boxed::Box<crate::query_dsl::PinnedQuery>),
Prefix(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>),
QueryString(crate::query_dsl::QueryStringQuery),
Range(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>),
RankFeature(crate::query_dsl::RankFeatureQuery),
Regexp(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>),
Rule(::std::boxed::Box<crate::query_dsl::RuleQuery>),
Script(crate::query_dsl::ScriptQuery),
ScriptScore(::std::boxed::Box<crate::query_dsl::ScriptScoreQuery>),
Semantic(crate::query_dsl::SemanticQuery),
Shape(crate::query_dsl::ShapeQuery),
SimpleQueryString(crate::query_dsl::SimpleQueryStringQuery),
SpanContaining(::std::boxed::Box<crate::query_dsl::SpanContainingQuery>),
SpanFieldMasking(::std::boxed::Box<crate::query_dsl::SpanFieldMaskingQuery>),
SpanFirst(::std::boxed::Box<crate::query_dsl::SpanFirstQuery>),
SpanMulti(::std::boxed::Box<crate::query_dsl::SpanMultiTermQuery>),
SpanNear(crate::query_dsl::SpanNearQuery),
SpanNot(::std::boxed::Box<crate::query_dsl::SpanNotQuery>),
SpanOr(crate::query_dsl::SpanOrQuery),
SpanTerm(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>),
SpanWithin(::std::boxed::Box<crate::query_dsl::SpanWithinQuery>),
SparseVector(crate::query_dsl::SparseVectorQuery),
Term(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>),
Terms(crate::query_dsl::TermsQuery),
TermsSet(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>),
TextExpansion(
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TextExpansionQuery>,
),
WeightedTokens(
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WeightedTokensQuery>,
),
Wildcard(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>),
Wrapper(crate::query_dsl::WrapperQuery),
Type(crate::query_dsl::TypeQuery),
Raw(::serde_json::Value),
}
impl QueryContainer {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::Bool(value) => map.serialize_entry("bool", value),
Self::Boosting(value) => map.serialize_entry("boosting", value),
Self::Common(value) => map.serialize_entry("common", value),
Self::CombinedFields(value) => map.serialize_entry("combined_fields", value),
Self::ConstantScore(value) => map.serialize_entry("constant_score", value),
Self::DisMax(value) => map.serialize_entry("dis_max", value),
Self::DistanceFeature(value) => map.serialize_entry("distance_feature", value),
Self::Exists(value) => map.serialize_entry("exists", value),
Self::FunctionScore(value) => map.serialize_entry("function_score", value),
Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
Self::GeoBoundingBox(value) => map.serialize_entry("geo_bounding_box", value),
Self::GeoDistance(value) => map.serialize_entry("geo_distance", value),
Self::GeoGrid(value) => map.serialize_entry("geo_grid", value),
Self::GeoPolygon(value) => map.serialize_entry("geo_polygon", value),
Self::GeoShape(value) => map.serialize_entry("geo_shape", value),
Self::HasChild(value) => map.serialize_entry("has_child", value),
Self::HasParent(value) => map.serialize_entry("has_parent", value),
Self::Ids(value) => map.serialize_entry("ids", value),
Self::Intervals(value) => map.serialize_entry("intervals", value),
Self::Knn(value) => map.serialize_entry("knn", value),
Self::Kql(value) => map.serialize_entry("kql", value),
Self::Match(value) => map.serialize_entry("match", value),
Self::MatchAll(value) => map.serialize_entry("match_all", value),
Self::MatchBoolPrefix(value) => map.serialize_entry("match_bool_prefix", value),
Self::MatchNone(value) => map.serialize_entry("match_none", value),
Self::MatchPhrase(value) => map.serialize_entry("match_phrase", value),
Self::MatchPhrasePrefix(value) => map.serialize_entry("match_phrase_prefix", value),
Self::MoreLikeThis(value) => map.serialize_entry("more_like_this", value),
Self::MultiMatch(value) => map.serialize_entry("multi_match", value),
Self::Nested(value) => map.serialize_entry("nested", value),
Self::ParentId(value) => map.serialize_entry("parent_id", value),
Self::Percolate(value) => map.serialize_entry("percolate", value),
Self::Pinned(value) => map.serialize_entry("pinned", value),
Self::Prefix(value) => map.serialize_entry("prefix", value),
Self::QueryString(value) => map.serialize_entry("query_string", value),
Self::Range(value) => map.serialize_entry("range", value),
Self::RankFeature(value) => map.serialize_entry("rank_feature", value),
Self::Regexp(value) => map.serialize_entry("regexp", value),
Self::Rule(value) => map.serialize_entry("rule", value),
Self::Script(value) => map.serialize_entry("script", value),
Self::ScriptScore(value) => map.serialize_entry("script_score", value),
Self::Semantic(value) => map.serialize_entry("semantic", value),
Self::Shape(value) => map.serialize_entry("shape", value),
Self::SimpleQueryString(value) => map.serialize_entry("simple_query_string", value),
Self::SpanContaining(value) => map.serialize_entry("span_containing", value),
Self::SpanFieldMasking(value) => map.serialize_entry("span_field_masking", value),
Self::SpanFirst(value) => map.serialize_entry("span_first", value),
Self::SpanMulti(value) => map.serialize_entry("span_multi", value),
Self::SpanNear(value) => map.serialize_entry("span_near", value),
Self::SpanNot(value) => map.serialize_entry("span_not", value),
Self::SpanOr(value) => map.serialize_entry("span_or", value),
Self::SpanTerm(value) => map.serialize_entry("span_term", value),
Self::SpanWithin(value) => map.serialize_entry("span_within", value),
Self::SparseVector(value) => map.serialize_entry("sparse_vector", value),
Self::Term(value) => map.serialize_entry("term", value),
Self::Terms(value) => map.serialize_entry("terms", value),
Self::TermsSet(value) => map.serialize_entry("terms_set", value),
Self::TextExpansion(value) => map.serialize_entry("text_expansion", value),
Self::WeightedTokens(value) => map.serialize_entry("weighted_tokens", value),
Self::Wildcard(value) => map.serialize_entry("wildcard", value),
Self::Wrapper(value) => map.serialize_entry("wrapper", value),
Self::Type(value) => map.serialize_entry("type", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for QueryContainer {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Bool(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "bool", value)
}
Self::Boosting(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "boosting", value)
}
Self::Common(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "common", value)
}
Self::CombinedFields(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "combined_fields", value)
}
Self::ConstantScore(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "constant_score", value)
}
Self::DisMax(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "dis_max", value)
}
Self::DistanceFeature(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "distance_feature", value)
}
Self::Exists(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "exists", value)
}
Self::FunctionScore(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "function_score", value)
}
Self::Fuzzy(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
}
Self::GeoBoundingBox(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geo_bounding_box", value)
}
Self::GeoDistance(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geo_distance", value)
}
Self::GeoGrid(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geo_grid", value)
}
Self::GeoPolygon(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geo_polygon", value)
}
Self::GeoShape(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "geo_shape", value)
}
Self::HasChild(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "has_child", value)
}
Self::HasParent(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "has_parent", value)
}
Self::Ids(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "ids", value)
}
Self::Intervals(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "intervals", value)
}
Self::Knn(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "knn", value)
}
Self::Kql(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "kql", value)
}
Self::Match(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "match", value)
}
Self::MatchAll(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "match_all", value)
}
Self::MatchBoolPrefix(value) => ::oxsearch_core::__private::serialize_variant(
serializer,
"match_bool_prefix",
value,
),
Self::MatchNone(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "match_none", value)
}
Self::MatchPhrase(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "match_phrase", value)
}
Self::MatchPhrasePrefix(value) => ::oxsearch_core::__private::serialize_variant(
serializer,
"match_phrase_prefix",
value,
),
Self::MoreLikeThis(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "more_like_this", value)
}
Self::MultiMatch(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "multi_match", value)
}
Self::Nested(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "nested", value)
}
Self::ParentId(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "parent_id", value)
}
Self::Percolate(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "percolate", value)
}
Self::Pinned(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "pinned", value)
}
Self::Prefix(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
}
Self::QueryString(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "query_string", value)
}
Self::Range(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "range", value)
}
Self::RankFeature(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "rank_feature", value)
}
Self::Regexp(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
}
Self::Rule(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "rule", value)
}
Self::Script(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "script", value)
}
Self::ScriptScore(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "script_score", value)
}
Self::Semantic(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "semantic", value)
}
Self::Shape(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "shape", value)
}
Self::SimpleQueryString(value) => ::oxsearch_core::__private::serialize_variant(
serializer,
"simple_query_string",
value,
),
Self::SpanContaining(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_containing", value)
}
Self::SpanFieldMasking(value) => ::oxsearch_core::__private::serialize_variant(
serializer,
"span_field_masking",
value,
),
Self::SpanFirst(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_first", value)
}
Self::SpanMulti(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_multi", value)
}
Self::SpanNear(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_near", value)
}
Self::SpanNot(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_not", value)
}
Self::SpanOr(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_or", value)
}
Self::SpanTerm(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_term", value)
}
Self::SpanWithin(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_within", value)
}
Self::SparseVector(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "sparse_vector", value)
}
Self::Term(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "term", value)
}
Self::Terms(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "terms", value)
}
Self::TermsSet(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "terms_set", value)
}
Self::TextExpansion(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "text_expansion", value)
}
Self::WeightedTokens(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "weighted_tokens", value)
}
Self::Wildcard(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
}
Self::Wrapper(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "wrapper", value)
}
Self::Type(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "type", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for QueryContainer {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for QueryContainer {
const NAME: &'static str = "QueryContainer";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"bool" => Self::Bool(map.next_value()?),
"boosting" => Self::Boosting(map.next_value()?),
"common" => Self::Common(map.next_value()?),
"combined_fields" => Self::CombinedFields(map.next_value()?),
"constant_score" => Self::ConstantScore(map.next_value()?),
"dis_max" => Self::DisMax(map.next_value()?),
"distance_feature" => Self::DistanceFeature(map.next_value()?),
"exists" => Self::Exists(map.next_value()?),
"function_score" => Self::FunctionScore(map.next_value()?),
"fuzzy" => Self::Fuzzy(map.next_value()?),
"geo_bounding_box" => Self::GeoBoundingBox(map.next_value()?),
"geo_distance" => Self::GeoDistance(map.next_value()?),
"geo_grid" => Self::GeoGrid(map.next_value()?),
"geo_polygon" => Self::GeoPolygon(map.next_value()?),
"geo_shape" => Self::GeoShape(map.next_value()?),
"has_child" => Self::HasChild(map.next_value()?),
"has_parent" => Self::HasParent(map.next_value()?),
"ids" => Self::Ids(map.next_value()?),
"intervals" => Self::Intervals(map.next_value()?),
"knn" => Self::Knn(map.next_value()?),
"kql" => Self::Kql(map.next_value()?),
"match" => Self::Match(map.next_value()?),
"match_all" => Self::MatchAll(map.next_value()?),
"match_bool_prefix" => Self::MatchBoolPrefix(map.next_value()?),
"match_none" => Self::MatchNone(map.next_value()?),
"match_phrase" => Self::MatchPhrase(map.next_value()?),
"match_phrase_prefix" => Self::MatchPhrasePrefix(map.next_value()?),
"more_like_this" => Self::MoreLikeThis(map.next_value()?),
"multi_match" => Self::MultiMatch(map.next_value()?),
"nested" => Self::Nested(map.next_value()?),
"parent_id" => Self::ParentId(map.next_value()?),
"percolate" => Self::Percolate(map.next_value()?),
"pinned" => Self::Pinned(map.next_value()?),
"prefix" => Self::Prefix(map.next_value()?),
"query_string" => Self::QueryString(map.next_value()?),
"range" => Self::Range(map.next_value()?),
"rank_feature" => Self::RankFeature(map.next_value()?),
"regexp" => Self::Regexp(map.next_value()?),
"rule" => Self::Rule(map.next_value()?),
"script" => Self::Script(map.next_value()?),
"script_score" => Self::ScriptScore(map.next_value()?),
"semantic" => Self::Semantic(map.next_value()?),
"shape" => Self::Shape(map.next_value()?),
"simple_query_string" => Self::SimpleQueryString(map.next_value()?),
"span_containing" => Self::SpanContaining(map.next_value()?),
"span_field_masking" => Self::SpanFieldMasking(map.next_value()?),
"span_first" => Self::SpanFirst(map.next_value()?),
"span_multi" => Self::SpanMulti(map.next_value()?),
"span_near" => Self::SpanNear(map.next_value()?),
"span_not" => Self::SpanNot(map.next_value()?),
"span_or" => Self::SpanOr(map.next_value()?),
"span_term" => Self::SpanTerm(map.next_value()?),
"span_within" => Self::SpanWithin(map.next_value()?),
"sparse_vector" => Self::SparseVector(map.next_value()?),
"term" => Self::Term(map.next_value()?),
"terms" => Self::Terms(map.next_value()?),
"terms_set" => Self::TermsSet(map.next_value()?),
"text_expansion" => Self::TextExpansion(map.next_value()?),
"weighted_tokens" => Self::WeightedTokens(map.next_value()?),
"wildcard" => Self::Wildcard(map.next_value()?),
"wrapper" => Self::Wrapper(map.next_value()?),
"type" => Self::Type(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<crate::query_dsl::BoolQuery> for QueryContainer {
fn from(value: crate::query_dsl::BoolQuery) -> Self {
Self::Bool(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::BoostingQuery> for QueryContainer {
fn from(value: crate::query_dsl::BoostingQuery) -> Self {
Self::Boosting(::std::boxed::Box::new(value))
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>,
) -> Self {
Self::Common(value)
}
}
impl ::core::convert::From<crate::query_dsl::CombinedFieldsQuery> for QueryContainer {
fn from(value: crate::query_dsl::CombinedFieldsQuery) -> Self {
Self::CombinedFields(value)
}
}
impl ::core::convert::From<crate::query_dsl::ConstantScoreQuery> for QueryContainer {
fn from(value: crate::query_dsl::ConstantScoreQuery) -> Self {
Self::ConstantScore(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::DisMaxQuery> for QueryContainer {
fn from(value: crate::query_dsl::DisMaxQuery) -> Self {
Self::DisMax(value)
}
}
impl ::core::convert::From<crate::query_dsl::DistanceFeatureQuery> for QueryContainer {
fn from(value: crate::query_dsl::DistanceFeatureQuery) -> Self {
Self::DistanceFeature(value)
}
}
impl ::core::convert::From<crate::query_dsl::ExistsQuery> for QueryContainer {
fn from(value: crate::query_dsl::ExistsQuery) -> Self {
Self::Exists(value)
}
}
impl ::core::convert::From<crate::query_dsl::FunctionScoreQuery> for QueryContainer {
fn from(value: crate::query_dsl::FunctionScoreQuery) -> Self {
Self::FunctionScore(::std::boxed::Box::new(value))
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>,
) -> Self {
Self::Fuzzy(value)
}
}
impl ::core::convert::From<crate::query_dsl::GeoBoundingBoxQuery> for QueryContainer {
fn from(value: crate::query_dsl::GeoBoundingBoxQuery) -> Self {
Self::GeoBoundingBox(value)
}
}
impl ::core::convert::From<crate::query_dsl::GeoDistanceQuery> for QueryContainer {
fn from(value: crate::query_dsl::GeoDistanceQuery) -> Self {
Self::GeoDistance(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>,
) -> Self {
Self::GeoGrid(value)
}
}
impl ::core::convert::From<crate::query_dsl::GeoPolygonQuery> for QueryContainer {
fn from(value: crate::query_dsl::GeoPolygonQuery) -> Self {
Self::GeoPolygon(value)
}
}
impl ::core::convert::From<crate::query_dsl::GeoShapeQuery> for QueryContainer {
fn from(value: crate::query_dsl::GeoShapeQuery) -> Self {
Self::GeoShape(value)
}
}
impl ::core::convert::From<crate::query_dsl::HasChildQuery> for QueryContainer {
fn from(value: crate::query_dsl::HasChildQuery) -> Self {
Self::HasChild(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::HasParentQuery> for QueryContainer {
fn from(value: crate::query_dsl::HasParentQuery) -> Self {
Self::HasParent(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::IdsQuery> for QueryContainer {
fn from(value: crate::query_dsl::IdsQuery) -> Self {
Self::Ids(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>,
) -> Self {
Self::Intervals(value)
}
}
impl ::core::convert::From<crate::KnnQuery> for QueryContainer {
fn from(value: crate::KnnQuery) -> Self {
Self::Knn(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::KqlQuery> for QueryContainer {
fn from(value: crate::query_dsl::KqlQuery) -> Self {
Self::Kql(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>,
) -> Self {
Self::Match(value)
}
}
impl ::core::convert::From<crate::query_dsl::MatchAllQuery> for QueryContainer {
fn from(value: crate::query_dsl::MatchAllQuery) -> Self {
Self::MatchAll(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchBoolPrefixQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<
crate::Field,
crate::query_dsl::MatchBoolPrefixQuery,
>,
) -> Self {
Self::MatchBoolPrefix(value)
}
}
impl ::core::convert::From<crate::query_dsl::MatchNoneQuery> for QueryContainer {
fn from(value: crate::query_dsl::MatchNoneQuery) -> Self {
Self::MatchNone(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
) -> Self {
Self::MatchPhrase(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhrasePrefixQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<
crate::Field,
crate::query_dsl::MatchPhrasePrefixQuery,
>,
) -> Self {
Self::MatchPhrasePrefix(value)
}
}
impl ::core::convert::From<crate::query_dsl::MoreLikeThisQuery> for QueryContainer {
fn from(value: crate::query_dsl::MoreLikeThisQuery) -> Self {
Self::MoreLikeThis(value)
}
}
impl ::core::convert::From<crate::query_dsl::MultiMatchQuery> for QueryContainer {
fn from(value: crate::query_dsl::MultiMatchQuery) -> Self {
Self::MultiMatch(value)
}
}
impl ::core::convert::From<crate::query_dsl::NestedQuery> for QueryContainer {
fn from(value: crate::query_dsl::NestedQuery) -> Self {
Self::Nested(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::ParentIdQuery> for QueryContainer {
fn from(value: crate::query_dsl::ParentIdQuery) -> Self {
Self::ParentId(value)
}
}
impl ::core::convert::From<crate::query_dsl::PercolateQuery> for QueryContainer {
fn from(value: crate::query_dsl::PercolateQuery) -> Self {
Self::Percolate(value)
}
}
impl ::core::convert::From<crate::query_dsl::PinnedQuery> for QueryContainer {
fn from(value: crate::query_dsl::PinnedQuery) -> Self {
Self::Pinned(::std::boxed::Box::new(value))
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>,
) -> Self {
Self::Prefix(value)
}
}
impl ::core::convert::From<crate::query_dsl::QueryStringQuery> for QueryContainer {
fn from(value: crate::query_dsl::QueryStringQuery) -> Self {
Self::QueryString(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>,
) -> Self {
Self::Range(value)
}
}
impl ::core::convert::From<crate::query_dsl::RankFeatureQuery> for QueryContainer {
fn from(value: crate::query_dsl::RankFeatureQuery) -> Self {
Self::RankFeature(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>,
) -> Self {
Self::Regexp(value)
}
}
impl ::core::convert::From<crate::query_dsl::RuleQuery> for QueryContainer {
fn from(value: crate::query_dsl::RuleQuery) -> Self {
Self::Rule(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::ScriptQuery> for QueryContainer {
fn from(value: crate::query_dsl::ScriptQuery) -> Self {
Self::Script(value)
}
}
impl ::core::convert::From<crate::query_dsl::ScriptScoreQuery> for QueryContainer {
fn from(value: crate::query_dsl::ScriptScoreQuery) -> Self {
Self::ScriptScore(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SemanticQuery> for QueryContainer {
fn from(value: crate::query_dsl::SemanticQuery) -> Self {
Self::Semantic(value)
}
}
impl ::core::convert::From<crate::query_dsl::ShapeQuery> for QueryContainer {
fn from(value: crate::query_dsl::ShapeQuery) -> Self {
Self::Shape(value)
}
}
impl ::core::convert::From<crate::query_dsl::SimpleQueryStringQuery> for QueryContainer {
fn from(value: crate::query_dsl::SimpleQueryStringQuery) -> Self {
Self::SimpleQueryString(value)
}
}
impl ::core::convert::From<crate::query_dsl::SpanContainingQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanContainingQuery) -> Self {
Self::SpanContaining(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanFieldMaskingQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanFieldMaskingQuery) -> Self {
Self::SpanFieldMasking(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanFirstQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanFirstQuery) -> Self {
Self::SpanFirst(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanMultiTermQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanMultiTermQuery) -> Self {
Self::SpanMulti(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanNearQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanNearQuery) -> Self {
Self::SpanNear(value)
}
}
impl ::core::convert::From<crate::query_dsl::SpanNotQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanNotQuery) -> Self {
Self::SpanNot(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanOrQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanOrQuery) -> Self {
Self::SpanOr(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
) -> Self {
Self::SpanTerm(value)
}
}
impl ::core::convert::From<crate::query_dsl::SpanWithinQuery> for QueryContainer {
fn from(value: crate::query_dsl::SpanWithinQuery) -> Self {
Self::SpanWithin(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SparseVectorQuery> for QueryContainer {
fn from(value: crate::query_dsl::SparseVectorQuery) -> Self {
Self::SparseVector(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>,
) -> Self {
Self::Term(value)
}
}
impl ::core::convert::From<crate::query_dsl::TermsQuery> for QueryContainer {
fn from(value: crate::query_dsl::TermsQuery) -> Self {
Self::Terms(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>,
) -> Self {
Self::TermsSet(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TextExpansionQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<
crate::Field,
crate::query_dsl::TextExpansionQuery,
>,
) -> Self {
Self::TextExpansion(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WeightedTokensQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<
crate::Field,
crate::query_dsl::WeightedTokensQuery,
>,
) -> Self {
Self::WeightedTokens(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>,
> for QueryContainer
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>,
) -> Self {
Self::Wildcard(value)
}
}
impl ::core::convert::From<crate::query_dsl::WrapperQuery> for QueryContainer {
fn from(value: crate::query_dsl::WrapperQuery) -> Self {
Self::Wrapper(value)
}
}
impl ::core::convert::From<crate::query_dsl::TypeQuery> for QueryContainer {
fn from(value: crate::query_dsl::TypeQuery) -> Self {
Self::Type(value)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct QueryStringQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub allow_leading_wildcard: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyze_wildcard: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub default_field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub default_operator: ::core::option::Option<crate::query_dsl::Operator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub enable_position_increments: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub escape: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzziness: ::core::option::Option<crate::Fuzziness>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_max_expansions: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_prefix_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_transpositions: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lenient: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_determinized_states: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub phrase_slop: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub quote_analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub quote_field_suffix: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub tie_breaker: ::core::option::Option<f64>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub time_zone: ::core::option::Option<crate::TimeZone>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub r#type: ::core::option::Option<crate::query_dsl::TextQueryType>,
}
impl QueryStringQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
allow_leading_wildcard: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
analyze_wildcard: ::core::option::Option::None,
auto_generate_synonyms_phrase_query: ::core::option::Option::None,
default_field: ::core::option::Option::None,
default_operator: ::core::option::Option::None,
enable_position_increments: ::core::option::Option::None,
escape: ::core::option::Option::None,
fields: ::core::option::Option::None,
fuzziness: ::core::option::Option::None,
fuzzy_max_expansions: ::core::option::Option::None,
fuzzy_prefix_length: ::core::option::Option::None,
fuzzy_rewrite: ::core::option::Option::None,
fuzzy_transpositions: ::core::option::Option::None,
lenient: ::core::option::Option::None,
max_determinized_states: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
phrase_slop: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
quote_analyzer: ::core::option::Option::None,
quote_field_suffix: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
tie_breaker: ::core::option::Option::None,
time_zone: ::core::option::Option::None,
r#type: ::core::option::Option::None,
}
}
}
impl QueryStringQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn allow_leading_wildcard(mut self, value: bool) -> Self {
self.allow_leading_wildcard = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn analyze_wildcard(mut self, value: bool) -> Self {
self.analyze_wildcard = ::core::option::Option::Some(value.into());
self
}
pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
self
}
pub fn default_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.default_field = ::core::option::Option::Some(value.into());
self
}
pub fn default_operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::Operator>,
) -> Self {
self.default_operator = ::core::option::Option::Some(value.into());
self
}
pub fn enable_position_increments(mut self, value: bool) -> Self {
self.enable_position_increments = ::core::option::Option::Some(value.into());
self
}
pub fn escape(mut self, value: bool) -> Self {
self.escape = ::core::option::Option::Some(value.into());
self
}
pub fn fields(
mut self,
value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
) -> Self {
self.fields = ::core::option::Option::Some(value.into());
self
}
pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
self.fuzziness = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_max_expansions(mut self, value: i32) -> Self {
self.fuzzy_max_expansions = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_prefix_length(mut self, value: i32) -> Self {
self.fuzzy_prefix_length = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
self
}
pub fn lenient(mut self, value: bool) -> Self {
self.lenient = ::core::option::Option::Some(value.into());
self
}
pub fn max_determinized_states(mut self, value: i32) -> Self {
self.max_determinized_states = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn phrase_slop(mut self, value: f64) -> Self {
self.phrase_slop = ::core::option::Option::Some(value.into());
self
}
pub fn quote_analyzer(
mut self,
value: impl ::core::convert::Into<::std::string::String>,
) -> Self {
self.quote_analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn quote_field_suffix(
mut self,
value: impl ::core::convert::Into<::std::string::String>,
) -> Self {
self.quote_field_suffix = ::core::option::Option::Some(value.into());
self
}
pub fn rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn tie_breaker(mut self, value: f64) -> Self {
self.tie_breaker = ::core::option::Option::Some(value.into());
self
}
pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
self.time_zone = ::core::option::Option::Some(value.into());
self
}
pub fn r#type(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::TextQueryType>,
) -> Self {
self.r#type = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RandomScoreFunctionSeed {
Long(i64),
String(::std::string::String),
}
impl ::serde::Serialize for RandomScoreFunctionSeed {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Long(value) => ::serde::Serialize::serialize(value, serializer),
Self::String(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for RandomScoreFunctionSeed {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Shape;
impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
type Value = RandomScoreFunctionSeed;
const EXPECTING: &'static str = "RandomScoreFunctionSeed: number or string";
fn visit<V__: ::serde::Deserializer<'de>>(
self,
kind: ::oxsearch_core::__private::Kind,
value: V__,
) -> ::core::result::Result<Self::Value, V__::Error> {
match kind {
::oxsearch_core::__private::Kind::Number => {
<i64 as ::serde::Deserialize>::deserialize(value)
.map(RandomScoreFunctionSeed::Long)
}
::oxsearch_core::__private::Kind::String => {
<::std::string::String as ::serde::Deserialize>::deserialize(value)
.map(RandomScoreFunctionSeed::String)
}
_ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
format_args!("RandomScoreFunctionSeed can't be {kind:?}"),
)),
}
}
}
::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
}
}
impl ::core::convert::From<i64> for RandomScoreFunctionSeed {
fn from(value: i64) -> Self {
Self::Long(value)
}
}
impl ::core::convert::From<::std::string::String> for RandomScoreFunctionSeed {
fn from(value: ::std::string::String) -> Self {
Self::String(value)
}
}
impl ::core::convert::From<&str> for RandomScoreFunctionSeed {
fn from(value: &str) -> Self {
Self::String(::std::borrow::ToOwned::to_owned(value))
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RandomScoreFunction {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub seed: ::core::option::Option<crate::query_dsl::RandomScoreFunctionSeed>,
}
impl RandomScoreFunction {
pub fn new() -> Self {
Self {
field: ::core::option::Option::None,
seed: ::core::option::Option::None,
}
}
}
impl RandomScoreFunction {
pub fn field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
self.field = ::core::option::Option::Some(value.into());
self
}
pub fn seed(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RandomScoreFunctionSeed>,
) -> Self {
self.seed = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RangeQuery {
Untyped(crate::query_dsl::UntypedRangeQuery),
Date(crate::query_dsl::DateRangeQuery),
Number(crate::query_dsl::NumberRangeQuery),
LongNumber(crate::query_dsl::LongNumberRangeQuery),
Term(crate::query_dsl::TermRangeQuery),
}
impl ::serde::Serialize for RangeQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
Self::Number(value) => ::serde::Serialize::serialize(value, serializer),
Self::LongNumber(value) => ::serde::Serialize::serialize(value, serializer),
Self::Term(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for RangeQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
}
}
impl ::core::convert::From<crate::query_dsl::UntypedRangeQuery> for RangeQuery {
fn from(value: crate::query_dsl::UntypedRangeQuery) -> Self {
Self::Untyped(value)
}
}
impl ::core::convert::From<crate::query_dsl::DateRangeQuery> for RangeQuery {
fn from(value: crate::query_dsl::DateRangeQuery) -> Self {
Self::Date(value)
}
}
impl ::core::convert::From<crate::query_dsl::NumberRangeQuery> for RangeQuery {
fn from(value: crate::query_dsl::NumberRangeQuery) -> Self {
Self::Number(value)
}
}
impl ::core::convert::From<crate::query_dsl::LongNumberRangeQuery> for RangeQuery {
fn from(value: crate::query_dsl::LongNumberRangeQuery) -> Self {
Self::LongNumber(value)
}
}
impl ::core::convert::From<crate::query_dsl::TermRangeQuery> for RangeQuery {
fn from(value: crate::query_dsl::TermRangeQuery) -> Self {
Self::Term(value)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RangeQueryBase<T = ::serde_json::Value> {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gt: ::core::option::Option<T>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gte: ::core::option::Option<T>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lt: ::core::option::Option<T>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lte: ::core::option::Option<T>,
}
impl RangeQueryBase<::serde_json::Value> {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
relation: ::core::option::Option::None,
gt: ::core::option::Option::None,
gte: ::core::option::Option::None,
lt: ::core::option::Option::None,
lte: ::core::option::Option::None,
}
}
}
impl<T> RangeQueryBase<T> {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn relation(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
pub fn gt(mut self, value: T) -> Self {
self.gt = ::core::option::Option::Some(value.into());
self
}
pub fn gte(mut self, value: T) -> Self {
self.gte = ::core::option::Option::Some(value.into());
self
}
pub fn lt(mut self, value: T) -> Self {
self.lt = ::core::option::Option::Some(value.into());
self
}
pub fn lte(mut self, value: T) -> Self {
self.lte = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum RangeRelation {
Within,
Contains,
Intersects,
Raw(::std::string::String),
}
impl RangeRelation {
pub fn as_str(&self) -> &str {
match self {
Self::Within => "within",
Self::Contains => "contains",
Self::Intersects => "intersects",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"within" => ::core::option::Option::Some(Self::Within),
"contains" => ::core::option::Option::Some(Self::Contains),
"intersects" => ::core::option::Option::Some(Self::Intersects),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for RangeRelation {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for RangeRelation {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"RangeRelation",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RankFeatureFunction {}
impl RankFeatureFunction {
pub fn new() -> Self {
Self {}
}
}
impl RankFeatureFunction {}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RankFeatureFunctionLinear {}
impl RankFeatureFunctionLinear {
pub fn new() -> Self {
Self {}
}
}
impl RankFeatureFunctionLinear {}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RankFeatureFunctionLogarithm {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub scaling_factor: ::core::option::Option<f32>,
}
impl RankFeatureFunctionLogarithm {
pub fn new(scaling_factor: f32) -> Self {
Self {
scaling_factor: ::core::option::Option::Some(scaling_factor.into()),
}
}
}
impl RankFeatureFunctionLogarithm {}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RankFeatureFunctionSaturation {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pivot: ::core::option::Option<f32>,
}
impl RankFeatureFunctionSaturation {
pub fn new() -> Self {
Self {
pivot: ::core::option::Option::None,
}
}
}
impl RankFeatureFunctionSaturation {
pub fn pivot(mut self, value: f32) -> Self {
self.pivot = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RankFeatureFunctionSigmoid {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pivot: ::core::option::Option<f32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub exponent: ::core::option::Option<f32>,
}
impl RankFeatureFunctionSigmoid {
pub fn new(pivot: f32, exponent: f32) -> Self {
Self {
pivot: ::core::option::Option::Some(pivot.into()),
exponent: ::core::option::Option::Some(exponent.into()),
}
}
}
impl RankFeatureFunctionSigmoid {}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RankFeatureQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub saturation: ::core::option::Option<crate::query_dsl::RankFeatureFunctionSaturation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub log: ::core::option::Option<crate::query_dsl::RankFeatureFunctionLogarithm>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub linear: ::core::option::Option<crate::query_dsl::RankFeatureFunctionLinear>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub sigmoid: ::core::option::Option<crate::query_dsl::RankFeatureFunctionSigmoid>,
}
impl RankFeatureQuery {
pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
field: ::core::option::Option::Some(field.into()),
saturation: ::core::option::Option::None,
log: ::core::option::Option::None,
linear: ::core::option::Option::None,
sigmoid: ::core::option::Option::None,
}
}
}
impl RankFeatureQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn saturation(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionSaturation>,
) -> Self {
self.saturation = ::core::option::Option::Some(value.into());
self
}
pub fn log(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionLogarithm>,
) -> Self {
self.log = ::core::option::Option::Some(value.into());
self
}
pub fn linear(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionLinear>,
) -> Self {
self.linear = ::core::option::Option::Some(value.into());
self
}
pub fn sigmoid(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionSigmoid>,
) -> Self {
self.sigmoid = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct RegexpQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub case_insensitive: ::core::option::Option<bool>,
pub flags: ::core::option::Option<::std::string::String>,
pub max_determinized_states: ::core::option::Option<i32>,
pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
pub value: ::core::option::Option<::std::string::String>,
}
impl RegexpQuery {
pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
case_insensitive: ::core::option::Option::None,
flags: ::core::option::Option::None,
max_determinized_states: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
value: ::core::option::Option::Some(value.into()),
}
}
}
impl RegexpQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn case_insensitive(mut self, value: bool) -> Self {
self.case_insensitive = ::core::option::Option::Some(value.into());
self
}
pub fn flags(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.flags = ::core::option::Option::Some(value.into());
self
}
pub fn max_determinized_states(mut self, value: i32) -> Self {
self.max_determinized_states = ::core::option::Option::Some(value.into());
self
}
pub fn rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.rewrite = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "RegexpQuery")]
struct RegexpQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
case_insensitive: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
flags: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
max_determinized_states: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
value: ::core::option::Option<::std::string::String>,
}
impl ::serde::Serialize for RegexpQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.value,
self.boost.is_none()
&& self.name.is_none()
&& self.case_insensitive.is_none()
&& self.flags.is_none()
&& self.max_determinized_states.is_none()
&& self.rewrite.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
RegexpQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for RegexpQuery {
type Short = ::std::string::String;
fn from_short(short: ::std::string::String) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
case_insensitive: ::core::option::Option::None,
flags: ::core::option::Option::None,
max_determinized_states: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
value: ::core::option::Option::Some(short),
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
RegexpQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for RegexpQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct RuleQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub organic: ::core::option::Option<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ruleset_ids: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ruleset_id: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub match_criteria: ::core::option::Option<::serde_json::Value>,
}
impl RuleQuery {
pub fn new(
organic: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
match_criteria: impl ::core::convert::Into<::serde_json::Value>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
organic: ::core::option::Option::Some(organic.into()),
ruleset_ids: ::core::option::Option::None,
ruleset_id: ::core::option::Option::None,
match_criteria: ::core::option::Option::Some(match_criteria.into()),
}
}
}
impl RuleQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn ruleset_ids(
mut self,
value: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
) -> Self {
self.ruleset_ids = ::core::option::Option::Some(value.into());
self
}
pub fn ruleset_id(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.ruleset_id = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ScriptQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub script: ::core::option::Option<crate::Script>,
}
impl ScriptQuery {
pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
script: ::core::option::Option::Some(script.into()),
}
}
}
impl ScriptQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ScriptScoreFunction {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub script: ::core::option::Option<crate::Script>,
}
impl ScriptScoreFunction {
pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
Self {
script: ::core::option::Option::Some(script.into()),
}
}
}
impl ScriptScoreFunction {}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ScriptScoreQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub min_score: ::core::option::Option<f32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub script: ::core::option::Option<crate::Script>,
}
impl ScriptScoreQuery {
pub fn new(
query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
script: impl ::core::convert::Into<crate::Script>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
min_score: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
script: ::core::option::Option::Some(script.into()),
}
}
}
impl ScriptScoreQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn min_score(mut self, value: f32) -> Self {
self.min_score = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SemanticQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
}
impl SemanticQuery {
pub fn new(
field: impl ::core::convert::Into<::std::string::String>,
query: impl ::core::convert::Into<::std::string::String>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
field: ::core::option::Option::Some(field.into()),
query: ::core::option::Option::Some(query.into()),
}
}
}
impl SemanticQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ShapeFieldQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub indexed_shape: ::core::option::Option<crate::query_dsl::FieldLookup>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::GeoShapeRelation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub shape: ::core::option::Option<crate::GeoShape>,
}
impl ShapeFieldQuery {
pub fn new() -> Self {
Self {
indexed_shape: ::core::option::Option::None,
relation: ::core::option::Option::None,
shape: ::core::option::Option::None,
}
}
}
impl ShapeFieldQuery {
pub fn indexed_shape(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::FieldLookup>,
) -> Self {
self.indexed_shape = ::core::option::Option::Some(value.into());
self
}
pub fn relation(mut self, value: impl ::core::convert::Into<crate::GeoShapeRelation>) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
pub fn shape(mut self, value: impl ::core::convert::Into<crate::GeoShape>) -> Self {
self.shape = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "ShapeQueryRepr", into = "ShapeQueryRepr")]
#[non_exhaustive]
pub struct ShapeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub ignore_unmapped: ::core::option::Option<bool>,
pub field: crate::Field,
pub shape: crate::query_dsl::ShapeFieldQuery,
}
impl ShapeQuery {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
shape: impl ::core::convert::Into<crate::query_dsl::ShapeFieldQuery>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
ignore_unmapped: ::core::option::Option::None,
field: field.into(),
shape: shape.into(),
}
}
}
impl ShapeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn ignore_unmapped(mut self, value: bool) -> Self {
self.ignore_unmapped = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct ShapeQueryRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
ignore_unmapped: ::core::option::Option<bool>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::ShapeFieldQuery>,
}
impl ::core::convert::TryFrom<ShapeQueryRepr> for ShapeQuery {
type Error = ::std::string::String;
fn try_from(repr: ShapeQueryRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, shape)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
boost: repr.boost,
name: repr.name,
ignore_unmapped: repr.ignore_unmapped,
field,
shape,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"ShapeQuery needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<ShapeQuery> for ShapeQueryRepr {
fn from(value: ShapeQuery) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.shape);
Self {
boost: value.boost,
name: value.name,
ignore_unmapped: value.ignore_unmapped,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum SimpleQueryStringFlag {
None,
And,
Not,
Or,
Prefix,
Phrase,
Precedence,
Escape,
Whitespace,
Fuzzy,
Near,
Slop,
All,
Raw(::std::string::String),
}
impl SimpleQueryStringFlag {
pub fn as_str(&self) -> &str {
match self {
Self::None => "NONE",
Self::And => "AND",
Self::Not => "NOT",
Self::Or => "OR",
Self::Prefix => "PREFIX",
Self::Phrase => "PHRASE",
Self::Precedence => "PRECEDENCE",
Self::Escape => "ESCAPE",
Self::Whitespace => "WHITESPACE",
Self::Fuzzy => "FUZZY",
Self::Near => "NEAR",
Self::Slop => "SLOP",
Self::All => "ALL",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"NONE" => ::core::option::Option::Some(Self::None),
"AND" => ::core::option::Option::Some(Self::And),
"NOT" => ::core::option::Option::Some(Self::Not),
"OR" => ::core::option::Option::Some(Self::Or),
"PREFIX" => ::core::option::Option::Some(Self::Prefix),
"PHRASE" => ::core::option::Option::Some(Self::Phrase),
"PRECEDENCE" => ::core::option::Option::Some(Self::Precedence),
"ESCAPE" => ::core::option::Option::Some(Self::Escape),
"WHITESPACE" => ::core::option::Option::Some(Self::Whitespace),
"FUZZY" => ::core::option::Option::Some(Self::Fuzzy),
"NEAR" => ::core::option::Option::Some(Self::Near),
"SLOP" => ::core::option::Option::Some(Self::Slop),
"ALL" => ::core::option::Option::Some(Self::All),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for SimpleQueryStringFlag {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for SimpleQueryStringFlag {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"SimpleQueryStringFlag",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
pub type SimpleQueryStringFlags =
::oxsearch_core::shapes::PipeSeparatedFlags<crate::query_dsl::SimpleQueryStringFlag>;
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SimpleQueryStringQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyzer: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub analyze_wildcard: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub default_operator: ::core::option::Option<crate::query_dsl::Operator>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub flags: ::core::option::Option<crate::query_dsl::SimpleQueryStringFlags>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_max_expansions: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_prefix_length: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub fuzzy_transpositions: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lenient: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub quote_field_suffix: ::core::option::Option<::std::string::String>,
}
impl SimpleQueryStringQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
analyzer: ::core::option::Option::None,
analyze_wildcard: ::core::option::Option::None,
auto_generate_synonyms_phrase_query: ::core::option::Option::None,
default_operator: ::core::option::Option::None,
fields: ::core::option::Option::None,
flags: ::core::option::Option::None,
fuzzy_max_expansions: ::core::option::Option::None,
fuzzy_prefix_length: ::core::option::Option::None,
fuzzy_transpositions: ::core::option::Option::None,
lenient: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
quote_field_suffix: ::core::option::Option::None,
}
}
}
impl SimpleQueryStringQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.analyzer = ::core::option::Option::Some(value.into());
self
}
pub fn analyze_wildcard(mut self, value: bool) -> Self {
self.analyze_wildcard = ::core::option::Option::Some(value.into());
self
}
pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
self
}
pub fn default_operator(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::Operator>,
) -> Self {
self.default_operator = ::core::option::Option::Some(value.into());
self
}
pub fn fields(
mut self,
value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
) -> Self {
self.fields = ::core::option::Option::Some(value.into());
self
}
pub fn flags(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::SimpleQueryStringFlags>,
) -> Self {
self.flags = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_max_expansions(mut self, value: i32) -> Self {
self.fuzzy_max_expansions = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_prefix_length(mut self, value: i32) -> Self {
self.fuzzy_prefix_length = ::core::option::Option::Some(value.into());
self
}
pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
self
}
pub fn lenient(mut self, value: bool) -> Self {
self.lenient = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn quote_field_suffix(
mut self,
value: impl ::core::convert::Into<::std::string::String>,
) -> Self {
self.quote_field_suffix = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanContainingQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub big: ::core::option::Option<crate::query_dsl::SpanQuery>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub little: ::core::option::Option<crate::query_dsl::SpanQuery>,
}
impl SpanContainingQuery {
pub fn new(
big: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
little: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
big: ::core::option::Option::Some(big.into()),
little: ::core::option::Option::Some(little.into()),
}
}
}
impl SpanContainingQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanFieldMaskingQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<crate::query_dsl::SpanQuery>,
}
impl SpanFieldMaskingQuery {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
query: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
field: ::core::option::Option::Some(field.into()),
query: ::core::option::Option::Some(query.into()),
}
}
}
impl SpanFieldMaskingQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanFirstQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub end: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub r#match: ::core::option::Option<crate::query_dsl::SpanQuery>,
}
impl SpanFirstQuery {
pub fn new(end: i32, r#match: impl ::core::convert::Into<crate::query_dsl::SpanQuery>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
end: ::core::option::Option::Some(end.into()),
r#match: ::core::option::Option::Some(r#match.into()),
}
}
}
impl SpanFirstQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
pub type SpanGapQuery = ::oxsearch_core::shapes::SingleKey<crate::Field, i32>;
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanMultiTermQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub r#match: ::core::option::Option<crate::query_dsl::QueryContainer>,
}
impl SpanMultiTermQuery {
pub fn new(r#match: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
r#match: ::core::option::Option::Some(r#match.into()),
}
}
}
impl SpanMultiTermQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanNearQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(default = "::core::default::Default::default")]
pub clauses: ::std::vec::Vec<crate::query_dsl::SpanQuery>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub in_order: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub slop: ::core::option::Option<i32>,
}
impl SpanNearQuery {
pub fn new(
clauses: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::SpanQuery>>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
clauses: clauses.into(),
in_order: ::core::option::Option::None,
slop: ::core::option::Option::None,
}
}
}
impl SpanNearQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn in_order(mut self, value: bool) -> Self {
self.in_order = ::core::option::Option::Some(value.into());
self
}
pub fn slop(mut self, value: i32) -> Self {
self.slop = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanNotQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub dist: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub exclude: ::core::option::Option<crate::query_dsl::SpanQuery>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub include: ::core::option::Option<crate::query_dsl::SpanQuery>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub post: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pre: ::core::option::Option<i32>,
}
impl SpanNotQuery {
pub fn new(
exclude: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
include: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
dist: ::core::option::Option::None,
exclude: ::core::option::Option::Some(exclude.into()),
include: ::core::option::Option::Some(include.into()),
post: ::core::option::Option::None,
pre: ::core::option::Option::None,
}
}
}
impl SpanNotQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn dist(mut self, value: i32) -> Self {
self.dist = ::core::option::Option::Some(value.into());
self
}
pub fn post(mut self, value: i32) -> Self {
self.post = ::core::option::Option::Some(value.into());
self
}
pub fn pre(mut self, value: i32) -> Self {
self.pre = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanOrQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(default = "::core::default::Default::default")]
pub clauses: ::std::vec::Vec<crate::query_dsl::SpanQuery>,
}
impl SpanOrQuery {
pub fn new(
clauses: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::SpanQuery>>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
clauses: clauses.into(),
}
}
}
impl SpanOrQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SpanQuery {
SpanContaining(::std::boxed::Box<crate::query_dsl::SpanContainingQuery>),
SpanFieldMasking(::std::boxed::Box<crate::query_dsl::SpanFieldMaskingQuery>),
SpanFirst(::std::boxed::Box<crate::query_dsl::SpanFirstQuery>),
SpanGap(crate::query_dsl::SpanGapQuery),
SpanMulti(::std::boxed::Box<crate::query_dsl::SpanMultiTermQuery>),
SpanNear(crate::query_dsl::SpanNearQuery),
SpanNot(::std::boxed::Box<crate::query_dsl::SpanNotQuery>),
SpanOr(crate::query_dsl::SpanOrQuery),
SpanTerm(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>),
SpanWithin(::std::boxed::Box<crate::query_dsl::SpanWithinQuery>),
Raw(::serde_json::Value),
}
impl SpanQuery {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::SpanContaining(value) => map.serialize_entry("span_containing", value),
Self::SpanFieldMasking(value) => map.serialize_entry("span_field_masking", value),
Self::SpanFirst(value) => map.serialize_entry("span_first", value),
Self::SpanGap(value) => map.serialize_entry("span_gap", value),
Self::SpanMulti(value) => map.serialize_entry("span_multi", value),
Self::SpanNear(value) => map.serialize_entry("span_near", value),
Self::SpanNot(value) => map.serialize_entry("span_not", value),
Self::SpanOr(value) => map.serialize_entry("span_or", value),
Self::SpanTerm(value) => map.serialize_entry("span_term", value),
Self::SpanWithin(value) => map.serialize_entry("span_within", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for SpanQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::SpanContaining(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_containing", value)
}
Self::SpanFieldMasking(value) => ::oxsearch_core::__private::serialize_variant(
serializer,
"span_field_masking",
value,
),
Self::SpanFirst(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_first", value)
}
Self::SpanGap(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_gap", value)
}
Self::SpanMulti(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_multi", value)
}
Self::SpanNear(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_near", value)
}
Self::SpanNot(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_not", value)
}
Self::SpanOr(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_or", value)
}
Self::SpanTerm(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_term", value)
}
Self::SpanWithin(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "span_within", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for SpanQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for SpanQuery {
const NAME: &'static str = "SpanQuery";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"span_containing" => Self::SpanContaining(map.next_value()?),
"span_field_masking" => Self::SpanFieldMasking(map.next_value()?),
"span_first" => Self::SpanFirst(map.next_value()?),
"span_gap" => Self::SpanGap(map.next_value()?),
"span_multi" => Self::SpanMulti(map.next_value()?),
"span_near" => Self::SpanNear(map.next_value()?),
"span_not" => Self::SpanNot(map.next_value()?),
"span_or" => Self::SpanOr(map.next_value()?),
"span_term" => Self::SpanTerm(map.next_value()?),
"span_within" => Self::SpanWithin(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<crate::query_dsl::SpanContainingQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanContainingQuery) -> Self {
Self::SpanContaining(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanFieldMaskingQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanFieldMaskingQuery) -> Self {
Self::SpanFieldMasking(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanFirstQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanFirstQuery) -> Self {
Self::SpanFirst(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanGapQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanGapQuery) -> Self {
Self::SpanGap(value)
}
}
impl ::core::convert::From<crate::query_dsl::SpanMultiTermQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanMultiTermQuery) -> Self {
Self::SpanMulti(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanNearQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanNearQuery) -> Self {
Self::SpanNear(value)
}
}
impl ::core::convert::From<crate::query_dsl::SpanNotQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanNotQuery) -> Self {
Self::SpanNot(::std::boxed::Box::new(value))
}
}
impl ::core::convert::From<crate::query_dsl::SpanOrQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanOrQuery) -> Self {
Self::SpanOr(value)
}
}
impl
::core::convert::From<
::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
> for SpanQuery
{
fn from(
value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
) -> Self {
Self::SpanTerm(value)
}
}
impl ::core::convert::From<crate::query_dsl::SpanWithinQuery> for SpanQuery {
fn from(value: crate::query_dsl::SpanWithinQuery) -> Self {
Self::SpanWithin(::std::boxed::Box::new(value))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct SpanTermQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub value: ::core::option::Option<crate::FieldValue>,
}
impl SpanTermQuery {
pub fn new(value: impl ::core::convert::Into<crate::FieldValue>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
value: ::core::option::Option::Some(value.into()),
}
}
}
impl SpanTermQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "SpanTermQuery")]
struct SpanTermQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(
alias = "term",
skip_serializing_if = "::core::option::Option::is_none"
)]
value: ::core::option::Option<crate::FieldValue>,
}
impl ::serde::Serialize for SpanTermQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) =
(&self.value, self.boost.is_none() && self.name.is_none())
{
return ::serde::Serialize::serialize(short, serializer);
}
SpanTermQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for SpanTermQuery {
type Short = crate::FieldValue;
fn from_short(short: crate::FieldValue) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
value: ::core::option::Option::Some(short),
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
SpanTermQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for SpanTermQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct SpanWithinQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub big: ::core::option::Option<crate::query_dsl::SpanQuery>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub little: ::core::option::Option<crate::query_dsl::SpanQuery>,
}
impl SpanWithinQuery {
pub fn new(
big: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
little: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
big: ::core::option::Option::Some(big.into()),
little: ::core::option::Option::Some(little.into()),
}
}
}
impl SpanWithinQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SparseVectorQueryVariant {
QueryVector(::indexmap::IndexMap<::std::string::String, f32>),
InferenceId(crate::Id),
Raw(::serde_json::Value),
}
impl SparseVectorQueryVariant {
pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
&self,
map: &mut M__,
) -> ::core::result::Result<(), M__::Error> {
match self {
Self::QueryVector(value) => map.serialize_entry("query_vector", value),
Self::InferenceId(value) => map.serialize_entry("inference_id", value),
Self::Raw(value) => match value {
::serde_json::Value::Object(entries) => {
for (key, value) in entries {
map.serialize_entry(key, value)?;
}
::core::result::Result::Ok(())
}
_ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
"a raw variant must be an object",
)),
},
}
}
}
impl ::serde::Serialize for SparseVectorQueryVariant {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::QueryVector(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "query_vector", value)
}
Self::InferenceId(value) => {
::oxsearch_core::__private::serialize_variant(serializer, "inference_id", value)
}
Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for SparseVectorQueryVariant {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_container(deserializer)
}
}
impl<'de> ::oxsearch_core::__private::Container<'de> for SparseVectorQueryVariant {
const NAME: &'static str = "SparseVectorQueryVariant";
fn variant<A__: ::serde::de::MapAccess<'de>>(
key: &str,
map: &mut A__,
) -> ::core::result::Result<Self, A__::Error> {
::core::result::Result::Ok(match key {
"query_vector" => Self::QueryVector(map.next_value()?),
"inference_id" => Self::InferenceId(map.next_value()?),
_ => Self::Raw(::oxsearch_core::__private::raw_variant(
key,
map.next_value()?,
)),
})
}
}
impl ::core::convert::From<::indexmap::IndexMap<::std::string::String, f32>>
for SparseVectorQueryVariant
{
fn from(value: ::indexmap::IndexMap<::std::string::String, f32>) -> Self {
Self::QueryVector(value)
}
}
impl ::core::convert::From<crate::Id> for SparseVectorQueryVariant {
fn from(value: crate::Id) -> Self {
Self::InferenceId(value)
}
}
impl ::core::convert::From<&str> for SparseVectorQueryVariant {
fn from(value: &str) -> Self {
Self::InferenceId(::std::borrow::ToOwned::to_owned(value))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct SparseVectorQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub field: ::core::option::Option<crate::Field>,
pub query: ::core::option::Option<::std::string::String>,
pub prune: ::core::option::Option<bool>,
pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
pub variant: ::core::option::Option<crate::query_dsl::SparseVectorQueryVariant>,
}
impl SparseVectorQuery {
pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
field: ::core::option::Option::Some(field.into()),
query: ::core::option::Option::None,
prune: ::core::option::Option::None,
pruning_config: ::core::option::Option::None,
variant: ::core::option::Option::None,
}
}
}
impl SparseVectorQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn query(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.query = ::core::option::Option::Some(value.into());
self
}
pub fn prune(mut self, value: bool) -> Self {
self.prune = ::core::option::Option::Some(value.into());
self
}
pub fn pruning_config(
mut self,
value: impl ::core::convert::Into<crate::TokenPruningConfig>,
) -> Self {
self.pruning_config = ::core::option::Option::Some(value.into());
self
}
pub fn variant(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::SparseVectorQueryVariant>,
) -> Self {
self.variant = ::core::option::Option::Some(value.into());
self
}
}
impl ::serde::Serialize for SparseVectorQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
use ::serde::ser::SerializeMap as _;
let mut map = serializer.serialize_map(::core::option::Option::None)?;
if let ::core::option::Option::Some(value) = &self.boost {
map.serialize_entry("boost", value)?;
}
if let ::core::option::Option::Some(value) = &self.name {
map.serialize_entry("_name", value)?;
}
if let ::core::option::Option::Some(value) = &self.field {
map.serialize_entry("field", value)?;
}
if let ::core::option::Option::Some(value) = &self.query {
map.serialize_entry("query", value)?;
}
if let ::core::option::Option::Some(value) = &self.prune {
map.serialize_entry("prune", value)?;
}
if let ::core::option::Option::Some(value) = &self.pruning_config {
map.serialize_entry("pruning_config", value)?;
}
if let ::core::option::Option::Some(variant) = &self.variant {
variant.serialize_entry(&mut map)?;
}
map.end()
}
}
impl<'de> ::serde::Deserialize<'de> for SparseVectorQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Fields;
impl<'de> ::serde::de::Visitor<'de> for Fields {
type Value = SparseVectorQuery;
fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.write_str("a SparseVectorQuery object")
}
fn visit_map<A__: ::serde::de::MapAccess<'de>>(
self,
mut map: A__,
) -> ::core::result::Result<SparseVectorQuery, A__::Error> {
let mut boost = ::core::option::Option::None;
let mut name = ::core::option::Option::None;
let mut field = ::core::option::Option::None;
let mut query = ::core::option::Option::None;
let mut prune = ::core::option::Option::None;
let mut pruning_config = ::core::option::Option::None;
let mut variant__ = ::core::option::Option::None;
while let ::core::option::Option::Some(key) =
map.next_key::<::std::string::String>()?
{
match key.as_str() {
"boost" => boost = ::core::option::Option::Some(map.next_value()?),
"_name" => name = ::core::option::Option::Some(map.next_value()?),
"field" => field = ::core::option::Option::Some(map.next_value()?),
"query" => query = ::core::option::Option::Some(map.next_value()?),
"prune" => prune = ::core::option::Option::Some(map.next_value()?),
"pruning_config" => {
pruning_config = ::core::option::Option::Some(map.next_value()?)
}
_ => {
if variant__.is_some() {
return ::core::result::Result::Err(
::oxsearch_core::__private::two_variants(
"SparseVectorQuery",
&key,
),
);
}
variant__ = ::core::option::Option::Some(<SparseVectorQueryVariant as ::oxsearch_core::__private::Container<'de>>::variant(&key, &mut map)?);
}
}
}
::core::result::Result::Ok(SparseVectorQuery {
boost,
name,
field,
query,
prune,
pruning_config,
variant: variant__,
})
}
}
deserializer.deserialize_map(Fields)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct TermQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub value: ::core::option::Option<crate::FieldValue>,
pub case_insensitive: ::core::option::Option<bool>,
}
impl TermQuery {
pub fn new(value: impl ::core::convert::Into<crate::FieldValue>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
value: ::core::option::Option::Some(value.into()),
case_insensitive: ::core::option::Option::None,
}
}
}
impl TermQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn case_insensitive(mut self, value: bool) -> Self {
self.case_insensitive = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "TermQuery")]
struct TermQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
value: ::core::option::Option<crate::FieldValue>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
case_insensitive: ::core::option::Option<bool>,
}
impl ::serde::Serialize for TermQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.value,
self.boost.is_none() && self.name.is_none() && self.case_insensitive.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
TermQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for TermQuery {
type Short = crate::FieldValue;
fn from_short(short: crate::FieldValue) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
value: ::core::option::Option::Some(short),
case_insensitive: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
TermQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for TermQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct TermRangeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gt: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gte: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lt: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lte: ::core::option::Option<::std::string::String>,
}
impl TermRangeQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
relation: ::core::option::Option::None,
gt: ::core::option::Option::None,
gte: ::core::option::Option::None,
lt: ::core::option::Option::None,
lte: ::core::option::Option::None,
}
}
}
impl TermRangeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn relation(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
pub fn gt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.gt = ::core::option::Option::Some(value.into());
self
}
pub fn gte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.gte = ::core::option::Option::Some(value.into());
self
}
pub fn lt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.lt = ::core::option::Option::Some(value.into());
self
}
pub fn lte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.lte = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct TermsLookup {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub index: ::core::option::Option<crate::IndexName>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub id: ::core::option::Option<crate::Id>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub path: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub routing: ::core::option::Option<::std::string::String>,
}
impl TermsLookup {
pub fn new(
index: impl ::core::convert::Into<crate::IndexName>,
id: impl ::core::convert::Into<crate::Id>,
path: impl ::core::convert::Into<crate::Field>,
) -> Self {
Self {
index: ::core::option::Option::Some(index.into()),
id: ::core::option::Option::Some(id.into()),
path: ::core::option::Option::Some(path.into()),
routing: ::core::option::Option::None,
}
}
}
impl TermsLookup {
pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.routing = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(try_from = "TermsQueryRepr", into = "TermsQueryRepr")]
#[non_exhaustive]
pub struct TermsQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
pub field: crate::Field,
pub terms: crate::query_dsl::TermsQueryField,
}
impl TermsQuery {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
terms: impl ::core::convert::Into<crate::query_dsl::TermsQueryField>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
field: field.into(),
terms: terms.into(),
}
}
}
impl TermsQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct TermsQueryRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::TermsQueryField>,
}
impl ::core::convert::TryFrom<TermsQueryRepr> for TermsQuery {
type Error = ::std::string::String;
fn try_from(repr: TermsQueryRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, terms)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
boost: repr.boost,
name: repr.name,
field,
terms,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"TermsQuery needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<TermsQuery> for TermsQueryRepr {
fn from(value: TermsQuery) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.terms);
Self {
boost: value.boost,
name: value.name,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TermsQueryField {
Value(::std::vec::Vec<crate::FieldValue>),
Lookup(crate::query_dsl::TermsLookup),
}
impl ::serde::Serialize for TermsQueryField {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
match self {
Self::Value(value) => ::serde::Serialize::serialize(value, serializer),
Self::Lookup(value) => ::serde::Serialize::serialize(value, serializer),
}
}
}
impl<'de> ::serde::Deserialize<'de> for TermsQueryField {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
struct Shape;
impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
type Value = TermsQueryField;
const EXPECTING: &'static str = "TermsQueryField: array or object";
fn visit<V__: ::serde::Deserializer<'de>>(
self,
kind: ::oxsearch_core::__private::Kind,
value: V__,
) -> ::core::result::Result<Self::Value, V__::Error> {
match kind {
::oxsearch_core::__private::Kind::Array => {
<::std::vec::Vec<crate::FieldValue> as ::serde::Deserialize>::deserialize(
value,
)
.map(TermsQueryField::Value)
}
::oxsearch_core::__private::Kind::Object => {
<crate::query_dsl::TermsLookup as ::serde::Deserialize>::deserialize(value)
.map(TermsQueryField::Lookup)
}
_ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
format_args!("TermsQueryField can't be {kind:?}"),
)),
}
}
}
::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
}
}
impl ::core::convert::From<::std::vec::Vec<crate::FieldValue>> for TermsQueryField {
fn from(value: ::std::vec::Vec<crate::FieldValue>) -> Self {
Self::Value(value)
}
}
impl ::core::convert::From<crate::query_dsl::TermsLookup> for TermsQueryField {
fn from(value: crate::query_dsl::TermsLookup) -> Self {
Self::Lookup(value)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct TermsSetQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match_field: ::core::option::Option<crate::Field>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub minimum_should_match_script: ::core::option::Option<crate::Script>,
#[serde(default = "::core::default::Default::default")]
pub terms: ::std::vec::Vec<crate::FieldValue>,
}
impl TermsSetQuery {
pub fn new(terms: impl ::core::convert::Into<::std::vec::Vec<crate::FieldValue>>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
minimum_should_match: ::core::option::Option::None,
minimum_should_match_field: ::core::option::Option::None,
minimum_should_match_script: ::core::option::Option::None,
terms: terms.into(),
}
}
}
impl TermsSetQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match(
mut self,
value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
) -> Self {
self.minimum_should_match = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match_field(
mut self,
value: impl ::core::convert::Into<crate::Field>,
) -> Self {
self.minimum_should_match_field = ::core::option::Option::Some(value.into());
self
}
pub fn minimum_should_match_script(
mut self,
value: impl ::core::convert::Into<crate::Script>,
) -> Self {
self.minimum_should_match_script = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct TextExpansionQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub model_id: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub model_text: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
}
impl TextExpansionQuery {
pub fn new(
model_id: impl ::core::convert::Into<::std::string::String>,
model_text: impl ::core::convert::Into<::std::string::String>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
model_id: ::core::option::Option::Some(model_id.into()),
model_text: ::core::option::Option::Some(model_text.into()),
pruning_config: ::core::option::Option::None,
}
}
}
impl TextExpansionQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn pruning_config(
mut self,
value: impl ::core::convert::Into<crate::TokenPruningConfig>,
) -> Self {
self.pruning_config = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum TextQueryType {
BestFields,
MostFields,
CrossFields,
Phrase,
PhrasePrefix,
BoolPrefix,
Raw(::std::string::String),
}
impl TextQueryType {
pub fn as_str(&self) -> &str {
match self {
Self::BestFields => "best_fields",
Self::MostFields => "most_fields",
Self::CrossFields => "cross_fields",
Self::Phrase => "phrase",
Self::PhrasePrefix => "phrase_prefix",
Self::BoolPrefix => "bool_prefix",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"best_fields" => ::core::option::Option::Some(Self::BestFields),
"most_fields" => ::core::option::Option::Some(Self::MostFields),
"cross_fields" => ::core::option::Option::Some(Self::CrossFields),
"phrase" => ::core::option::Option::Some(Self::Phrase),
"phrase_prefix" => ::core::option::Option::Some(Self::PhrasePrefix),
"bool_prefix" => ::core::option::Option::Some(Self::BoolPrefix),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for TextQueryType {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for TextQueryType {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"TextQueryType",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct TypeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub value: ::core::option::Option<::std::string::String>,
}
impl TypeQuery {
pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
value: ::core::option::Option::Some(value.into()),
}
}
}
impl TypeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(
try_from = "UntypedDecayFunctionRepr",
into = "UntypedDecayFunctionRepr"
)]
#[non_exhaustive]
pub struct UntypedDecayFunction {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
pub field: crate::Field,
pub placement: crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
}
impl UntypedDecayFunction {
pub fn new(
field: impl ::core::convert::Into<crate::Field>,
placement: impl ::core::convert::Into<
crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
>,
) -> Self {
Self {
multi_value_mode: ::core::option::Option::None,
field: field.into(),
placement: placement.into(),
}
}
}
impl UntypedDecayFunction {
pub fn multi_value_mode(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
) -> Self {
self.multi_value_mode = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
struct UntypedDecayFunctionRepr {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
#[serde(flatten)]
keyed__: ::indexmap::IndexMap<
crate::Field,
crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
>,
}
impl ::core::convert::TryFrom<UntypedDecayFunctionRepr> for UntypedDecayFunction {
type Error = ::std::string::String;
fn try_from(repr: UntypedDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
let mut keyed = repr.keyed__.into_iter();
match (keyed.next(), keyed.next()) {
(::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
::core::result::Result::Ok(Self {
multi_value_mode: repr.multi_value_mode,
field,
placement,
})
}
_ => ::core::result::Result::Err(::std::string::String::from(
"UntypedDecayFunction needs exactly one property keyed by its field",
)),
}
}
}
impl ::core::convert::From<UntypedDecayFunction> for UntypedDecayFunctionRepr {
fn from(value: UntypedDecayFunction) -> Self {
let mut keyed__ = ::indexmap::IndexMap::new();
keyed__.insert(value.field, value.placement);
Self {
multi_value_mode: value.multi_value_mode,
keyed__,
}
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct UntypedDistanceFeatureQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub origin: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pivot: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub field: ::core::option::Option<crate::Field>,
}
impl UntypedDistanceFeatureQuery {
pub fn new(
origin: impl ::core::convert::Into<::serde_json::Value>,
pivot: impl ::core::convert::Into<::serde_json::Value>,
field: impl ::core::convert::Into<crate::Field>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
origin: ::core::option::Option::Some(origin.into()),
pivot: ::core::option::Option::Some(pivot.into()),
field: ::core::option::Option::Some(field.into()),
}
}
}
impl UntypedDistanceFeatureQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct UntypedRangeQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gt: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub gte: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lt: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub lte: ::core::option::Option<::serde_json::Value>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub format: ::core::option::Option<crate::DateFormat>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub time_zone: ::core::option::Option<crate::TimeZone>,
}
impl UntypedRangeQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
relation: ::core::option::Option::None,
gt: ::core::option::Option::None,
gte: ::core::option::Option::None,
lt: ::core::option::Option::None,
lte: ::core::option::Option::None,
format: ::core::option::Option::None,
time_zone: ::core::option::Option::None,
}
}
}
impl UntypedRangeQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn relation(
mut self,
value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
) -> Self {
self.relation = ::core::option::Option::Some(value.into());
self
}
pub fn gt(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
self.gt = ::core::option::Option::Some(value.into());
self
}
pub fn gte(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
self.gte = ::core::option::Option::Some(value.into());
self
}
pub fn lt(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
self.lt = ::core::option::Option::Some(value.into());
self
}
pub fn lte(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
self.lte = ::core::option::Option::Some(value.into());
self
}
pub fn format(mut self, value: impl ::core::convert::Into<crate::DateFormat>) -> Self {
self.format = ::core::option::Option::Some(value.into());
self
}
pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
self.time_zone = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct WeightedTokensQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub tokens: ::core::option::Option<
::oxsearch_core::shapes::OneOrMany<::indexmap::IndexMap<::std::string::String, f32>>,
>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
}
impl WeightedTokensQuery {
pub fn new(
tokens: impl ::core::convert::Into<
::oxsearch_core::shapes::OneOrMany<::indexmap::IndexMap<::std::string::String, f32>>,
>,
) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
tokens: ::core::option::Option::Some(tokens.into()),
pruning_config: ::core::option::Option::None,
}
}
}
impl WeightedTokensQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn pruning_config(
mut self,
value: impl ::core::convert::Into<crate::TokenPruningConfig>,
) -> Self {
self.pruning_config = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct WildcardQuery {
pub boost: ::core::option::Option<f32>,
pub name: ::core::option::Option<::std::string::String>,
pub case_insensitive: ::core::option::Option<bool>,
pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
pub value: ::core::option::Option<::std::string::String>,
pub wildcard: ::core::option::Option<::std::string::String>,
}
impl WildcardQuery {
pub fn new() -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
case_insensitive: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
value: ::core::option::Option::None,
wildcard: ::core::option::Option::None,
}
}
}
impl WildcardQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
pub fn case_insensitive(mut self, value: bool) -> Self {
self.case_insensitive = ::core::option::Option::Some(value.into());
self
}
pub fn rewrite(
mut self,
value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
) -> Self {
self.rewrite = ::core::option::Option::Some(value.into());
self
}
pub fn value(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.value = ::core::option::Option::Some(value.into());
self
}
pub fn wildcard(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.wildcard = ::core::option::Option::Some(value.into());
self
}
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(remote = "WildcardQuery")]
struct WildcardQueryDef {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
case_insensitive: ::core::option::Option<bool>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
value: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
wildcard: ::core::option::Option<::std::string::String>,
}
impl ::serde::Serialize for WildcardQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
if let (::core::option::Option::Some(short), true) = (
&self.value,
self.boost.is_none()
&& self.name.is_none()
&& self.case_insensitive.is_none()
&& self.rewrite.is_none()
&& self.wildcard.is_none(),
) {
return ::serde::Serialize::serialize(short, serializer);
}
WildcardQueryDef::serialize(self, serializer)
}
}
impl<'de> ::oxsearch_core::__private::Shorthand<'de> for WildcardQuery {
type Short = ::std::string::String;
fn from_short(short: ::std::string::String) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
case_insensitive: ::core::option::Option::None,
rewrite: ::core::option::Option::None,
value: ::core::option::Option::Some(short),
wildcard: ::core::option::Option::None,
}
}
fn deserialize_full<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
WildcardQueryDef::deserialize(deserializer)
}
}
impl<'de> ::serde::Deserialize<'de> for WildcardQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_shorthand(deserializer)
}
}
#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct WrapperQuery {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub boost: ::core::option::Option<f32>,
#[serde(
rename = "_name",
skip_serializing_if = "::core::option::Option::is_none"
)]
pub name: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub query: ::core::option::Option<::std::string::String>,
}
impl WrapperQuery {
pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
Self {
boost: ::core::option::Option::None,
name: ::core::option::Option::None,
query: ::core::option::Option::Some(query.into()),
}
}
}
impl WrapperQuery {
pub fn boost(mut self, value: f32) -> Self {
self.boost = ::core::option::Option::Some(value.into());
self
}
pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.name = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ZeroTermsQuery {
All,
None,
Raw(::std::string::String),
}
impl ZeroTermsQuery {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::None => "none",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"all" => ::core::option::Option::Some(Self::All),
"none" => ::core::option::Option::Some(Self::None),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for ZeroTermsQuery {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for ZeroTermsQuery {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(
deserializer,
"ZeroTermsQuery",
|value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
)
}
}