1#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5#[non_exhaustive]
6pub struct BoolQuery {
7 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12 pub boost: ::core::option::Option<f32>,
13 #[serde(
14 rename = "_name",
15 skip_serializing_if = "::core::option::Option::is_none"
16 )]
17 pub name: ::core::option::Option<::std::string::String>,
18 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
21 pub filter: ::core::option::Option<
22 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
23 >,
24 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
26 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
27 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
29 pub must: ::core::option::Option<
30 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
31 >,
32 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
35 pub must_not: ::core::option::Option<
36 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
37 >,
38 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
40 pub should: ::core::option::Option<
41 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
42 >,
43}
44
45impl BoolQuery {
46 pub fn new() -> Self {
48 Self {
49 boost: ::core::option::Option::None,
50 name: ::core::option::Option::None,
51 filter: ::core::option::Option::None,
52 minimum_should_match: ::core::option::Option::None,
53 must: ::core::option::Option::None,
54 must_not: ::core::option::Option::None,
55 should: ::core::option::Option::None,
56 }
57 }
58}
59
60impl BoolQuery {
61 pub fn boost(mut self, value: f32) -> Self {
63 self.boost = ::core::option::Option::Some(value.into());
64 self
65 }
66 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
68 self.name = ::core::option::Option::Some(value.into());
69 self
70 }
71 pub fn filter(
73 mut self,
74 value: impl ::core::convert::Into<
75 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
76 >,
77 ) -> Self {
78 self.filter = ::core::option::Option::Some(value.into());
79 self
80 }
81 pub fn minimum_should_match(
83 mut self,
84 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
85 ) -> Self {
86 self.minimum_should_match = ::core::option::Option::Some(value.into());
87 self
88 }
89 pub fn must(
91 mut self,
92 value: impl ::core::convert::Into<
93 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
94 >,
95 ) -> Self {
96 self.must = ::core::option::Option::Some(value.into());
97 self
98 }
99 pub fn must_not(
101 mut self,
102 value: impl ::core::convert::Into<
103 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
104 >,
105 ) -> Self {
106 self.must_not = ::core::option::Option::Some(value.into());
107 self
108 }
109 pub fn should(
111 mut self,
112 value: impl ::core::convert::Into<
113 ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
114 >,
115 ) -> Self {
116 self.should = ::core::option::Option::Some(value.into());
117 self
118 }
119}
120
121#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
122#[non_exhaustive]
123pub struct BoostingQuery {
124 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
129 pub boost: ::core::option::Option<f32>,
130 #[serde(
131 rename = "_name",
132 skip_serializing_if = "::core::option::Option::is_none"
133 )]
134 pub name: ::core::option::Option<::std::string::String>,
135 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
137 pub negative_boost: ::core::option::Option<f64>,
138 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
140 pub negative: ::core::option::Option<crate::query_dsl::QueryContainer>,
141 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
143 pub positive: ::core::option::Option<crate::query_dsl::QueryContainer>,
144}
145
146impl BoostingQuery {
147 pub fn new(
149 negative_boost: f64,
150 negative: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
151 positive: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
152 ) -> Self {
153 Self {
154 boost: ::core::option::Option::None,
155 name: ::core::option::Option::None,
156 negative_boost: ::core::option::Option::Some(negative_boost.into()),
157 negative: ::core::option::Option::Some(negative.into()),
158 positive: ::core::option::Option::Some(positive.into()),
159 }
160 }
161}
162
163impl BoostingQuery {
164 pub fn boost(mut self, value: f32) -> Self {
166 self.boost = ::core::option::Option::Some(value.into());
167 self
168 }
169 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
171 self.name = ::core::option::Option::Some(value.into());
172 self
173 }
174}
175
176#[derive(Clone, Debug, PartialEq, Eq, Hash)]
177#[non_exhaustive]
178pub enum ChildScoreMode {
179 None,
181 Avg,
183 Sum,
185 Max,
187 Min,
189 Raw(::std::string::String),
191}
192
193impl ChildScoreMode {
194 pub fn as_str(&self) -> &str {
196 match self {
197 Self::None => "none",
198 Self::Avg => "avg",
199 Self::Sum => "sum",
200 Self::Max => "max",
201 Self::Min => "min",
202 Self::Raw(value) => value,
203 }
204 }
205
206 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
208 match value {
209 "none" => ::core::option::Option::Some(Self::None),
210 "avg" => ::core::option::Option::Some(Self::Avg),
211 "sum" => ::core::option::Option::Some(Self::Sum),
212 "max" => ::core::option::Option::Some(Self::Max),
213 "min" => ::core::option::Option::Some(Self::Min),
214 _ => ::core::option::Option::None,
215 }
216 }
217}
218
219impl ::serde::Serialize for ChildScoreMode {
220 fn serialize<S__: ::serde::Serializer>(
221 &self,
222 serializer: S__,
223 ) -> ::core::result::Result<S__::Ok, S__::Error> {
224 serializer.serialize_str(self.as_str())
225 }
226}
227
228impl<'de> ::serde::Deserialize<'de> for ChildScoreMode {
229 fn deserialize<D__: ::serde::Deserializer<'de>>(
230 deserializer: D__,
231 ) -> ::core::result::Result<Self, D__::Error> {
232 ::oxsearch_core::__private::deserialize_string_enum(
233 deserializer,
234 "ChildScoreMode",
235 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
236 )
237 }
238}
239
240#[derive(Clone, Debug, PartialEq, Eq, Hash)]
241#[non_exhaustive]
242pub enum CombinedFieldsOperator {
243 Or,
245 And,
247 Raw(::std::string::String),
249}
250
251impl CombinedFieldsOperator {
252 pub fn as_str(&self) -> &str {
254 match self {
255 Self::Or => "or",
256 Self::And => "and",
257 Self::Raw(value) => value,
258 }
259 }
260
261 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
263 match value {
264 "or" => ::core::option::Option::Some(Self::Or),
265 "and" => ::core::option::Option::Some(Self::And),
266 _ => ::core::option::Option::None,
267 }
268 }
269}
270
271impl ::serde::Serialize for CombinedFieldsOperator {
272 fn serialize<S__: ::serde::Serializer>(
273 &self,
274 serializer: S__,
275 ) -> ::core::result::Result<S__::Ok, S__::Error> {
276 serializer.serialize_str(self.as_str())
277 }
278}
279
280impl<'de> ::serde::Deserialize<'de> for CombinedFieldsOperator {
281 fn deserialize<D__: ::serde::Deserializer<'de>>(
282 deserializer: D__,
283 ) -> ::core::result::Result<Self, D__::Error> {
284 ::oxsearch_core::__private::deserialize_string_enum(
285 deserializer,
286 "CombinedFieldsOperator",
287 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
288 )
289 }
290}
291
292#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
293#[non_exhaustive]
294pub struct CombinedFieldsQuery {
295 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
300 pub boost: ::core::option::Option<f32>,
301 #[serde(
302 rename = "_name",
303 skip_serializing_if = "::core::option::Option::is_none"
304 )]
305 pub name: ::core::option::Option<::std::string::String>,
306 #[serde(default = "::core::default::Default::default")]
308 pub fields: ::std::vec::Vec<crate::Field>,
309 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
312 pub query: ::core::option::Option<::std::string::String>,
313 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
315 pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
316 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
318 pub operator: ::core::option::Option<crate::query_dsl::CombinedFieldsOperator>,
319 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
321 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
322 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
324 pub zero_terms_query: ::core::option::Option<crate::query_dsl::CombinedFieldsZeroTerms>,
325}
326
327impl CombinedFieldsQuery {
328 pub fn new(
330 fields: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
331 query: impl ::core::convert::Into<::std::string::String>,
332 ) -> Self {
333 Self {
334 boost: ::core::option::Option::None,
335 name: ::core::option::Option::None,
336 fields: fields.into(),
337 query: ::core::option::Option::Some(query.into()),
338 auto_generate_synonyms_phrase_query: ::core::option::Option::None,
339 operator: ::core::option::Option::None,
340 minimum_should_match: ::core::option::Option::None,
341 zero_terms_query: ::core::option::Option::None,
342 }
343 }
344}
345
346impl CombinedFieldsQuery {
347 pub fn boost(mut self, value: f32) -> Self {
349 self.boost = ::core::option::Option::Some(value.into());
350 self
351 }
352 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
354 self.name = ::core::option::Option::Some(value.into());
355 self
356 }
357 pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
359 self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
360 self
361 }
362 pub fn operator(
364 mut self,
365 value: impl ::core::convert::Into<crate::query_dsl::CombinedFieldsOperator>,
366 ) -> Self {
367 self.operator = ::core::option::Option::Some(value.into());
368 self
369 }
370 pub fn minimum_should_match(
372 mut self,
373 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
374 ) -> Self {
375 self.minimum_should_match = ::core::option::Option::Some(value.into());
376 self
377 }
378 pub fn zero_terms_query(
380 mut self,
381 value: impl ::core::convert::Into<crate::query_dsl::CombinedFieldsZeroTerms>,
382 ) -> Self {
383 self.zero_terms_query = ::core::option::Option::Some(value.into());
384 self
385 }
386}
387
388#[derive(Clone, Debug, PartialEq, Eq, Hash)]
389#[non_exhaustive]
390pub enum CombinedFieldsZeroTerms {
391 None,
393 All,
395 Raw(::std::string::String),
397}
398
399impl CombinedFieldsZeroTerms {
400 pub fn as_str(&self) -> &str {
402 match self {
403 Self::None => "none",
404 Self::All => "all",
405 Self::Raw(value) => value,
406 }
407 }
408
409 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
411 match value {
412 "none" => ::core::option::Option::Some(Self::None),
413 "all" => ::core::option::Option::Some(Self::All),
414 _ => ::core::option::Option::None,
415 }
416 }
417}
418
419impl ::serde::Serialize for CombinedFieldsZeroTerms {
420 fn serialize<S__: ::serde::Serializer>(
421 &self,
422 serializer: S__,
423 ) -> ::core::result::Result<S__::Ok, S__::Error> {
424 serializer.serialize_str(self.as_str())
425 }
426}
427
428impl<'de> ::serde::Deserialize<'de> for CombinedFieldsZeroTerms {
429 fn deserialize<D__: ::serde::Deserializer<'de>>(
430 deserializer: D__,
431 ) -> ::core::result::Result<Self, D__::Error> {
432 ::oxsearch_core::__private::deserialize_string_enum(
433 deserializer,
434 "CombinedFieldsZeroTerms",
435 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
436 )
437 }
438}
439
440#[derive(Clone, Debug, PartialEq)]
441#[non_exhaustive]
442pub struct CommonTermsQuery {
443 pub boost: ::core::option::Option<f32>,
448 pub name: ::core::option::Option<::std::string::String>,
449 pub analyzer: ::core::option::Option<::std::string::String>,
450 pub cutoff_frequency: ::core::option::Option<f64>,
451 pub high_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
452 pub low_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
453 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
454 pub query: ::core::option::Option<::std::string::String>,
455}
456
457impl CommonTermsQuery {
458 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
460 Self {
461 boost: ::core::option::Option::None,
462 name: ::core::option::Option::None,
463 analyzer: ::core::option::Option::None,
464 cutoff_frequency: ::core::option::Option::None,
465 high_freq_operator: ::core::option::Option::None,
466 low_freq_operator: ::core::option::Option::None,
467 minimum_should_match: ::core::option::Option::None,
468 query: ::core::option::Option::Some(query.into()),
469 }
470 }
471}
472
473impl CommonTermsQuery {
474 pub fn boost(mut self, value: f32) -> Self {
476 self.boost = ::core::option::Option::Some(value.into());
477 self
478 }
479 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
481 self.name = ::core::option::Option::Some(value.into());
482 self
483 }
484 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
486 self.analyzer = ::core::option::Option::Some(value.into());
487 self
488 }
489 pub fn cutoff_frequency(mut self, value: f64) -> Self {
491 self.cutoff_frequency = ::core::option::Option::Some(value.into());
492 self
493 }
494 pub fn high_freq_operator(
496 mut self,
497 value: impl ::core::convert::Into<crate::query_dsl::Operator>,
498 ) -> Self {
499 self.high_freq_operator = ::core::option::Option::Some(value.into());
500 self
501 }
502 pub fn low_freq_operator(
504 mut self,
505 value: impl ::core::convert::Into<crate::query_dsl::Operator>,
506 ) -> Self {
507 self.low_freq_operator = ::core::option::Option::Some(value.into());
508 self
509 }
510 pub fn minimum_should_match(
512 mut self,
513 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
514 ) -> Self {
515 self.minimum_should_match = ::core::option::Option::Some(value.into());
516 self
517 }
518}
519
520#[derive(::serde::Serialize, ::serde::Deserialize)]
521#[serde(remote = "CommonTermsQuery")]
522struct CommonTermsQueryDef {
523 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
528 boost: ::core::option::Option<f32>,
529 #[serde(
530 rename = "_name",
531 skip_serializing_if = "::core::option::Option::is_none"
532 )]
533 name: ::core::option::Option<::std::string::String>,
534 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
535 analyzer: ::core::option::Option<::std::string::String>,
536 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
537 cutoff_frequency: ::core::option::Option<f64>,
538 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
539 high_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
540 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
541 low_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
542 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
543 minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
544 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
545 query: ::core::option::Option<::std::string::String>,
546}
547
548impl ::serde::Serialize for CommonTermsQuery {
549 fn serialize<S__: ::serde::Serializer>(
550 &self,
551 serializer: S__,
552 ) -> ::core::result::Result<S__::Ok, S__::Error> {
553 if let (::core::option::Option::Some(short), true) = (
554 &self.query,
555 self.boost.is_none()
556 && self.name.is_none()
557 && self.analyzer.is_none()
558 && self.cutoff_frequency.is_none()
559 && self.high_freq_operator.is_none()
560 && self.low_freq_operator.is_none()
561 && self.minimum_should_match.is_none(),
562 ) {
563 return ::serde::Serialize::serialize(short, serializer);
564 }
565 CommonTermsQueryDef::serialize(self, serializer)
566 }
567}
568
569impl<'de> ::oxsearch_core::__private::Shorthand<'de> for CommonTermsQuery {
570 type Short = ::std::string::String;
571 fn from_short(short: ::std::string::String) -> Self {
572 Self {
573 boost: ::core::option::Option::None,
574 name: ::core::option::Option::None,
575 analyzer: ::core::option::Option::None,
576 cutoff_frequency: ::core::option::Option::None,
577 high_freq_operator: ::core::option::Option::None,
578 low_freq_operator: ::core::option::Option::None,
579 minimum_should_match: ::core::option::Option::None,
580 query: ::core::option::Option::Some(short),
581 }
582 }
583 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
584 deserializer: D__,
585 ) -> ::core::result::Result<Self, D__::Error> {
586 CommonTermsQueryDef::deserialize(deserializer)
587 }
588}
589
590impl<'de> ::serde::Deserialize<'de> for CommonTermsQuery {
591 fn deserialize<D__: ::serde::Deserializer<'de>>(
592 deserializer: D__,
593 ) -> ::core::result::Result<Self, D__::Error> {
594 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
595 }
596}
597
598#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
599#[non_exhaustive]
600pub struct ConstantScoreQuery {
601 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
606 pub boost: ::core::option::Option<f32>,
607 #[serde(
608 rename = "_name",
609 skip_serializing_if = "::core::option::Option::is_none"
610 )]
611 pub name: ::core::option::Option<::std::string::String>,
612 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
616 pub filter: ::core::option::Option<crate::query_dsl::QueryContainer>,
617}
618
619impl ConstantScoreQuery {
620 pub fn new(filter: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
622 Self {
623 boost: ::core::option::Option::None,
624 name: ::core::option::Option::None,
625 filter: ::core::option::Option::Some(filter.into()),
626 }
627 }
628}
629
630impl ConstantScoreQuery {
631 pub fn boost(mut self, value: f32) -> Self {
633 self.boost = ::core::option::Option::Some(value.into());
634 self
635 }
636 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
638 self.name = ::core::option::Option::Some(value.into());
639 self
640 }
641}
642
643#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
644#[serde(try_from = "DateDecayFunctionRepr", into = "DateDecayFunctionRepr")]
645#[non_exhaustive]
646pub struct DateDecayFunction {
647 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
649 pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
650 pub field: crate::Field,
652 pub placement: crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
654}
655
656impl DateDecayFunction {
657 pub fn new(
659 field: impl ::core::convert::Into<crate::Field>,
660 placement: impl ::core::convert::Into<
661 crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
662 >,
663 ) -> Self {
664 Self {
665 multi_value_mode: ::core::option::Option::None,
666 field: field.into(),
667 placement: placement.into(),
668 }
669 }
670}
671
672impl DateDecayFunction {
673 pub fn multi_value_mode(
675 mut self,
676 value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
677 ) -> Self {
678 self.multi_value_mode = ::core::option::Option::Some(value.into());
679 self
680 }
681}
682
683#[derive(::serde::Serialize, ::serde::Deserialize)]
684struct DateDecayFunctionRepr {
685 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
687 multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
688 #[serde(flatten)]
689 keyed__: ::indexmap::IndexMap<
690 crate::Field,
691 crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
692 >,
693}
694
695impl ::core::convert::TryFrom<DateDecayFunctionRepr> for DateDecayFunction {
696 type Error = ::std::string::String;
697 fn try_from(repr: DateDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
698 let mut keyed = repr.keyed__.into_iter();
699 match (keyed.next(), keyed.next()) {
700 (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
701 ::core::result::Result::Ok(Self {
702 multi_value_mode: repr.multi_value_mode,
703 field,
704 placement,
705 })
706 }
707 _ => ::core::result::Result::Err(::std::string::String::from(
708 "DateDecayFunction needs exactly one property keyed by its field",
709 )),
710 }
711 }
712}
713
714impl ::core::convert::From<DateDecayFunction> for DateDecayFunctionRepr {
715 fn from(value: DateDecayFunction) -> Self {
716 let mut keyed__ = ::indexmap::IndexMap::new();
717 keyed__.insert(value.field, value.placement);
718 Self {
719 multi_value_mode: value.multi_value_mode,
720 keyed__,
721 }
722 }
723}
724
725#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
726#[non_exhaustive]
727pub struct DateDistanceFeatureQuery {
728 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
733 pub boost: ::core::option::Option<f32>,
734 #[serde(
735 rename = "_name",
736 skip_serializing_if = "::core::option::Option::is_none"
737 )]
738 pub name: ::core::option::Option<::std::string::String>,
739 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
744 pub origin: ::core::option::Option<crate::DateMath>,
745 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
748 pub pivot: ::core::option::Option<crate::Duration>,
749 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
754 pub field: ::core::option::Option<crate::Field>,
755}
756
757impl DateDistanceFeatureQuery {
758 pub fn new(
760 origin: impl ::core::convert::Into<crate::DateMath>,
761 pivot: impl ::core::convert::Into<crate::Duration>,
762 field: impl ::core::convert::Into<crate::Field>,
763 ) -> Self {
764 Self {
765 boost: ::core::option::Option::None,
766 name: ::core::option::Option::None,
767 origin: ::core::option::Option::Some(origin.into()),
768 pivot: ::core::option::Option::Some(pivot.into()),
769 field: ::core::option::Option::Some(field.into()),
770 }
771 }
772}
773
774impl DateDistanceFeatureQuery {
775 pub fn boost(mut self, value: f32) -> Self {
777 self.boost = ::core::option::Option::Some(value.into());
778 self
779 }
780 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
782 self.name = ::core::option::Option::Some(value.into());
783 self
784 }
785}
786
787#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
788#[non_exhaustive]
789pub struct DateRangeQuery {
790 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
795 pub boost: ::core::option::Option<f32>,
796 #[serde(
797 rename = "_name",
798 skip_serializing_if = "::core::option::Option::is_none"
799 )]
800 pub name: ::core::option::Option<::std::string::String>,
801 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
803 pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
804 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
806 pub gt: ::core::option::Option<crate::DateMath>,
807 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
809 pub gte: ::core::option::Option<crate::DateMath>,
810 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
812 pub lt: ::core::option::Option<crate::DateMath>,
813 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
815 pub lte: ::core::option::Option<crate::DateMath>,
816 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
818 pub format: ::core::option::Option<crate::DateFormat>,
819 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
821 pub time_zone: ::core::option::Option<crate::TimeZone>,
822}
823
824impl DateRangeQuery {
825 pub fn new() -> Self {
827 Self {
828 boost: ::core::option::Option::None,
829 name: ::core::option::Option::None,
830 relation: ::core::option::Option::None,
831 gt: ::core::option::Option::None,
832 gte: ::core::option::Option::None,
833 lt: ::core::option::Option::None,
834 lte: ::core::option::Option::None,
835 format: ::core::option::Option::None,
836 time_zone: ::core::option::Option::None,
837 }
838 }
839}
840
841impl DateRangeQuery {
842 pub fn boost(mut self, value: f32) -> Self {
844 self.boost = ::core::option::Option::Some(value.into());
845 self
846 }
847 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
849 self.name = ::core::option::Option::Some(value.into());
850 self
851 }
852 pub fn relation(
854 mut self,
855 value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
856 ) -> Self {
857 self.relation = ::core::option::Option::Some(value.into());
858 self
859 }
860 pub fn gt(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
862 self.gt = ::core::option::Option::Some(value.into());
863 self
864 }
865 pub fn gte(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
867 self.gte = ::core::option::Option::Some(value.into());
868 self
869 }
870 pub fn lt(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
872 self.lt = ::core::option::Option::Some(value.into());
873 self
874 }
875 pub fn lte(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
877 self.lte = ::core::option::Option::Some(value.into());
878 self
879 }
880 pub fn format(mut self, value: impl ::core::convert::Into<crate::DateFormat>) -> Self {
882 self.format = ::core::option::Option::Some(value.into());
883 self
884 }
885 pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
887 self.time_zone = ::core::option::Option::Some(value.into());
888 self
889 }
890}
891
892#[derive(Clone, Debug, PartialEq)]
893#[non_exhaustive]
894pub enum DecayFunction {
895 Untyped(crate::query_dsl::UntypedDecayFunction),
897 Date(crate::query_dsl::DateDecayFunction),
899 Numeric(crate::query_dsl::NumericDecayFunction),
901 Geo(crate::query_dsl::GeoDecayFunction),
903}
904
905impl ::serde::Serialize for DecayFunction {
906 fn serialize<S__: ::serde::Serializer>(
907 &self,
908 serializer: S__,
909 ) -> ::core::result::Result<S__::Ok, S__::Error> {
910 match self {
911 Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
912 Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
913 Self::Numeric(value) => ::serde::Serialize::serialize(value, serializer),
914 Self::Geo(value) => ::serde::Serialize::serialize(value, serializer),
915 }
916 }
917}
918
919impl<'de> ::serde::Deserialize<'de> for DecayFunction {
920 fn deserialize<D__: ::serde::Deserializer<'de>>(
922 deserializer: D__,
923 ) -> ::core::result::Result<Self, D__::Error> {
924 ::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
925 }
926}
927
928impl ::core::convert::From<crate::query_dsl::UntypedDecayFunction> for DecayFunction {
929 fn from(value: crate::query_dsl::UntypedDecayFunction) -> Self {
930 Self::Untyped(value)
931 }
932}
933
934impl ::core::convert::From<crate::query_dsl::DateDecayFunction> for DecayFunction {
935 fn from(value: crate::query_dsl::DateDecayFunction) -> Self {
936 Self::Date(value)
937 }
938}
939
940impl ::core::convert::From<crate::query_dsl::NumericDecayFunction> for DecayFunction {
941 fn from(value: crate::query_dsl::NumericDecayFunction) -> Self {
942 Self::Numeric(value)
943 }
944}
945
946impl ::core::convert::From<crate::query_dsl::GeoDecayFunction> for DecayFunction {
947 fn from(value: crate::query_dsl::GeoDecayFunction) -> Self {
948 Self::Geo(value)
949 }
950}
951
952#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
953#[serde(
954 try_from = "DecayFunctionBaseRepr<TOrigin, TScale>",
955 into = "DecayFunctionBaseRepr<TOrigin, TScale>"
956)]
957#[serde(bound(
958 serialize = "TOrigin: ::serde::Serialize + ::core::clone::Clone, TScale: ::serde::Serialize + ::core::clone::Clone"
959))]
960#[non_exhaustive]
961pub struct DecayFunctionBase<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
962 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
964 pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
965 pub field: crate::Field,
967 pub placement: crate::query_dsl::DecayPlacement<TOrigin, TScale>,
969}
970
971impl<TOrigin, TScale> DecayFunctionBase<TOrigin, TScale> {
972 pub fn new(
974 field: impl ::core::convert::Into<crate::Field>,
975 placement: impl ::core::convert::Into<crate::query_dsl::DecayPlacement<TOrigin, TScale>>,
976 ) -> Self {
977 Self {
978 multi_value_mode: ::core::option::Option::None,
979 field: field.into(),
980 placement: placement.into(),
981 }
982 }
983}
984
985impl<TOrigin, TScale> DecayFunctionBase<TOrigin, TScale> {
986 pub fn multi_value_mode(
988 mut self,
989 value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
990 ) -> Self {
991 self.multi_value_mode = ::core::option::Option::Some(value.into());
992 self
993 }
994}
995
996#[derive(::serde::Serialize, ::serde::Deserialize)]
997struct DecayFunctionBaseRepr<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
998 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1000 multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
1001 #[serde(flatten)]
1002 keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::DecayPlacement<TOrigin, TScale>>,
1003}
1004
1005impl<TOrigin, TScale> ::core::convert::TryFrom<DecayFunctionBaseRepr<TOrigin, TScale>>
1006 for DecayFunctionBase<TOrigin, TScale>
1007{
1008 type Error = ::std::string::String;
1009 fn try_from(
1010 repr: DecayFunctionBaseRepr<TOrigin, TScale>,
1011 ) -> ::core::result::Result<Self, Self::Error> {
1012 let mut keyed = repr.keyed__.into_iter();
1013 match (keyed.next(), keyed.next()) {
1014 (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
1015 ::core::result::Result::Ok(Self {
1016 multi_value_mode: repr.multi_value_mode,
1017 field,
1018 placement,
1019 })
1020 }
1021 _ => ::core::result::Result::Err(::std::string::String::from(
1022 "DecayFunctionBase needs exactly one property keyed by its field",
1023 )),
1024 }
1025 }
1026}
1027
1028impl<TOrigin, TScale> ::core::convert::From<DecayFunctionBase<TOrigin, TScale>>
1029 for DecayFunctionBaseRepr<TOrigin, TScale>
1030{
1031 fn from(value: DecayFunctionBase<TOrigin, TScale>) -> Self {
1032 let mut keyed__ = ::indexmap::IndexMap::new();
1033 keyed__.insert(value.field, value.placement);
1034 Self {
1035 multi_value_mode: value.multi_value_mode,
1036 keyed__,
1037 }
1038 }
1039}
1040
1041#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1042#[non_exhaustive]
1043pub struct DecayPlacement<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
1044 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1046 pub decay: ::core::option::Option<f64>,
1047 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1049 pub offset: ::core::option::Option<TScale>,
1050 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1052 pub scale: ::core::option::Option<TScale>,
1053 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1055 pub origin: ::core::option::Option<TOrigin>,
1056}
1057
1058impl DecayPlacement<::serde_json::Value, ::serde_json::Value> {
1059 pub fn new() -> Self {
1061 Self {
1062 decay: ::core::option::Option::None,
1063 offset: ::core::option::Option::None,
1064 scale: ::core::option::Option::None,
1065 origin: ::core::option::Option::None,
1066 }
1067 }
1068}
1069
1070impl<TOrigin, TScale> DecayPlacement<TOrigin, TScale> {
1071 pub fn decay(mut self, value: f64) -> Self {
1073 self.decay = ::core::option::Option::Some(value.into());
1074 self
1075 }
1076 pub fn offset(mut self, value: TScale) -> Self {
1078 self.offset = ::core::option::Option::Some(value.into());
1079 self
1080 }
1081 pub fn scale(mut self, value: TScale) -> Self {
1083 self.scale = ::core::option::Option::Some(value.into());
1084 self
1085 }
1086 pub fn origin<TOrigin2>(self, value: TOrigin2) -> DecayPlacement<TOrigin2, TScale> {
1088 DecayPlacement {
1089 decay: self.decay,
1090 offset: self.offset,
1091 scale: self.scale,
1092 origin: ::core::option::Option::Some(value.into()),
1093 }
1094 }
1095}
1096
1097#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1098#[non_exhaustive]
1099pub struct DisMaxQuery {
1100 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1105 pub boost: ::core::option::Option<f32>,
1106 #[serde(
1107 rename = "_name",
1108 skip_serializing_if = "::core::option::Option::is_none"
1109 )]
1110 pub name: ::core::option::Option<::std::string::String>,
1111 #[serde(default = "::core::default::Default::default")]
1115 pub queries: ::std::vec::Vec<crate::query_dsl::QueryContainer>,
1116 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1118 pub tie_breaker: ::core::option::Option<f64>,
1119}
1120
1121impl DisMaxQuery {
1122 pub fn new(
1124 queries: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::QueryContainer>>,
1125 ) -> Self {
1126 Self {
1127 boost: ::core::option::Option::None,
1128 name: ::core::option::Option::None,
1129 queries: queries.into(),
1130 tie_breaker: ::core::option::Option::None,
1131 }
1132 }
1133}
1134
1135impl DisMaxQuery {
1136 pub fn boost(mut self, value: f32) -> Self {
1138 self.boost = ::core::option::Option::Some(value.into());
1139 self
1140 }
1141 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1143 self.name = ::core::option::Option::Some(value.into());
1144 self
1145 }
1146 pub fn tie_breaker(mut self, value: f64) -> Self {
1148 self.tie_breaker = ::core::option::Option::Some(value.into());
1149 self
1150 }
1151}
1152
1153#[derive(Clone, Debug, PartialEq)]
1154#[non_exhaustive]
1155pub enum DistanceFeatureQuery {
1156 Untyped(crate::query_dsl::UntypedDistanceFeatureQuery),
1158 Geo(crate::query_dsl::GeoDistanceFeatureQuery),
1160 Date(crate::query_dsl::DateDistanceFeatureQuery),
1162}
1163
1164impl ::serde::Serialize for DistanceFeatureQuery {
1165 fn serialize<S__: ::serde::Serializer>(
1166 &self,
1167 serializer: S__,
1168 ) -> ::core::result::Result<S__::Ok, S__::Error> {
1169 match self {
1170 Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
1171 Self::Geo(value) => ::serde::Serialize::serialize(value, serializer),
1172 Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
1173 }
1174 }
1175}
1176
1177impl<'de> ::serde::Deserialize<'de> for DistanceFeatureQuery {
1178 fn deserialize<D__: ::serde::Deserializer<'de>>(
1180 deserializer: D__,
1181 ) -> ::core::result::Result<Self, D__::Error> {
1182 ::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
1183 }
1184}
1185
1186impl ::core::convert::From<crate::query_dsl::UntypedDistanceFeatureQuery> for DistanceFeatureQuery {
1187 fn from(value: crate::query_dsl::UntypedDistanceFeatureQuery) -> Self {
1188 Self::Untyped(value)
1189 }
1190}
1191
1192impl ::core::convert::From<crate::query_dsl::GeoDistanceFeatureQuery> for DistanceFeatureQuery {
1193 fn from(value: crate::query_dsl::GeoDistanceFeatureQuery) -> Self {
1194 Self::Geo(value)
1195 }
1196}
1197
1198impl ::core::convert::From<crate::query_dsl::DateDistanceFeatureQuery> for DistanceFeatureQuery {
1199 fn from(value: crate::query_dsl::DateDistanceFeatureQuery) -> Self {
1200 Self::Date(value)
1201 }
1202}
1203
1204#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1205#[non_exhaustive]
1206pub struct DistanceFeatureQueryBase<TOrigin = ::serde_json::Value, TDistance = ::serde_json::Value>
1207{
1208 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1213 pub boost: ::core::option::Option<f32>,
1214 #[serde(
1215 rename = "_name",
1216 skip_serializing_if = "::core::option::Option::is_none"
1217 )]
1218 pub name: ::core::option::Option<::std::string::String>,
1219 pub origin: TOrigin,
1224 pub pivot: TDistance,
1227 pub field: crate::Field,
1232}
1233
1234impl<TOrigin, TDistance> DistanceFeatureQueryBase<TOrigin, TDistance> {
1235 pub fn new(
1237 origin: TOrigin,
1238 pivot: TDistance,
1239 field: impl ::core::convert::Into<crate::Field>,
1240 ) -> Self {
1241 Self {
1242 boost: ::core::option::Option::None,
1243 name: ::core::option::Option::None,
1244 origin: origin.into(),
1245 pivot: pivot.into(),
1246 field: field.into(),
1247 }
1248 }
1249}
1250
1251impl<TOrigin, TDistance> DistanceFeatureQueryBase<TOrigin, TDistance> {
1252 pub fn boost(mut self, value: f32) -> Self {
1254 self.boost = ::core::option::Option::Some(value.into());
1255 self
1256 }
1257 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1259 self.name = ::core::option::Option::Some(value.into());
1260 self
1261 }
1262}
1263
1264#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1265#[non_exhaustive]
1266pub struct ExistsQuery {
1267 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1272 pub boost: ::core::option::Option<f32>,
1273 #[serde(
1274 rename = "_name",
1275 skip_serializing_if = "::core::option::Option::is_none"
1276 )]
1277 pub name: ::core::option::Option<::std::string::String>,
1278 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1280 pub field: ::core::option::Option<crate::Field>,
1281}
1282
1283impl ExistsQuery {
1284 pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
1286 Self {
1287 boost: ::core::option::Option::None,
1288 name: ::core::option::Option::None,
1289 field: ::core::option::Option::Some(field.into()),
1290 }
1291 }
1292}
1293
1294impl ExistsQuery {
1295 pub fn boost(mut self, value: f32) -> Self {
1297 self.boost = ::core::option::Option::Some(value.into());
1298 self
1299 }
1300 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1302 self.name = ::core::option::Option::Some(value.into());
1303 self
1304 }
1305}
1306
1307#[derive(Clone, Debug, PartialEq)]
1309#[non_exhaustive]
1310pub struct FieldAndFormat {
1311 pub field: ::core::option::Option<crate::Field>,
1313 pub format: ::core::option::Option<::std::string::String>,
1315 pub include_unmapped: ::core::option::Option<bool>,
1316}
1317
1318impl FieldAndFormat {
1319 pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
1321 Self {
1322 field: ::core::option::Option::Some(field.into()),
1323 format: ::core::option::Option::None,
1324 include_unmapped: ::core::option::Option::None,
1325 }
1326 }
1327}
1328
1329impl FieldAndFormat {
1330 pub fn format(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1332 self.format = ::core::option::Option::Some(value.into());
1333 self
1334 }
1335 pub fn include_unmapped(mut self, value: bool) -> Self {
1337 self.include_unmapped = ::core::option::Option::Some(value.into());
1338 self
1339 }
1340}
1341
1342#[derive(::serde::Serialize, ::serde::Deserialize)]
1343#[serde(remote = "FieldAndFormat")]
1344struct FieldAndFormatDef {
1345 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1347 field: ::core::option::Option<crate::Field>,
1348 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1350 format: ::core::option::Option<::std::string::String>,
1351 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1352 include_unmapped: ::core::option::Option<bool>,
1353}
1354
1355impl ::serde::Serialize for FieldAndFormat {
1356 fn serialize<S__: ::serde::Serializer>(
1357 &self,
1358 serializer: S__,
1359 ) -> ::core::result::Result<S__::Ok, S__::Error> {
1360 if let (::core::option::Option::Some(short), true) = (
1361 &self.field,
1362 self.format.is_none() && self.include_unmapped.is_none(),
1363 ) {
1364 return ::serde::Serialize::serialize(short, serializer);
1365 }
1366 FieldAndFormatDef::serialize(self, serializer)
1367 }
1368}
1369
1370impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FieldAndFormat {
1371 type Short = crate::Field;
1372 fn from_short(short: crate::Field) -> Self {
1373 Self {
1374 field: ::core::option::Option::Some(short),
1375 format: ::core::option::Option::None,
1376 include_unmapped: ::core::option::Option::None,
1377 }
1378 }
1379 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
1380 deserializer: D__,
1381 ) -> ::core::result::Result<Self, D__::Error> {
1382 FieldAndFormatDef::deserialize(deserializer)
1383 }
1384}
1385
1386impl<'de> ::serde::Deserialize<'de> for FieldAndFormat {
1387 fn deserialize<D__: ::serde::Deserializer<'de>>(
1388 deserializer: D__,
1389 ) -> ::core::result::Result<Self, D__::Error> {
1390 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
1391 }
1392}
1393
1394#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1395#[non_exhaustive]
1396pub struct FieldLookup {
1397 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1399 pub id: ::core::option::Option<crate::Id>,
1400 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1402 pub index: ::core::option::Option<crate::IndexName>,
1403 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1405 pub path: ::core::option::Option<crate::Field>,
1406 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1408 pub routing: ::core::option::Option<::std::string::String>,
1409}
1410
1411impl FieldLookup {
1412 pub fn new(id: impl ::core::convert::Into<crate::Id>) -> Self {
1414 Self {
1415 id: ::core::option::Option::Some(id.into()),
1416 index: ::core::option::Option::None,
1417 path: ::core::option::Option::None,
1418 routing: ::core::option::Option::None,
1419 }
1420 }
1421}
1422
1423impl FieldLookup {
1424 pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
1426 self.index = ::core::option::Option::Some(value.into());
1427 self
1428 }
1429 pub fn path(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
1431 self.path = ::core::option::Option::Some(value.into());
1432 self
1433 }
1434 pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1436 self.routing = ::core::option::Option::Some(value.into());
1437 self
1438 }
1439}
1440
1441#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1442#[non_exhaustive]
1443pub enum FieldValueFactorModifier {
1444 None,
1446 Log,
1449 Log1P,
1451 Log2P,
1453 Ln,
1456 Ln1P,
1458 Ln2P,
1460 Square,
1462 Sqrt,
1464 Reciprocal,
1466 Raw(::std::string::String),
1468}
1469
1470impl FieldValueFactorModifier {
1471 pub fn as_str(&self) -> &str {
1473 match self {
1474 Self::None => "none",
1475 Self::Log => "log",
1476 Self::Log1P => "log1p",
1477 Self::Log2P => "log2p",
1478 Self::Ln => "ln",
1479 Self::Ln1P => "ln1p",
1480 Self::Ln2P => "ln2p",
1481 Self::Square => "square",
1482 Self::Sqrt => "sqrt",
1483 Self::Reciprocal => "reciprocal",
1484 Self::Raw(value) => value,
1485 }
1486 }
1487
1488 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1490 match value {
1491 "none" => ::core::option::Option::Some(Self::None),
1492 "log" => ::core::option::Option::Some(Self::Log),
1493 "log1p" => ::core::option::Option::Some(Self::Log1P),
1494 "log2p" => ::core::option::Option::Some(Self::Log2P),
1495 "ln" => ::core::option::Option::Some(Self::Ln),
1496 "ln1p" => ::core::option::Option::Some(Self::Ln1P),
1497 "ln2p" => ::core::option::Option::Some(Self::Ln2P),
1498 "square" => ::core::option::Option::Some(Self::Square),
1499 "sqrt" => ::core::option::Option::Some(Self::Sqrt),
1500 "reciprocal" => ::core::option::Option::Some(Self::Reciprocal),
1501 _ => ::core::option::Option::None,
1502 }
1503 }
1504}
1505
1506impl ::serde::Serialize for FieldValueFactorModifier {
1507 fn serialize<S__: ::serde::Serializer>(
1508 &self,
1509 serializer: S__,
1510 ) -> ::core::result::Result<S__::Ok, S__::Error> {
1511 serializer.serialize_str(self.as_str())
1512 }
1513}
1514
1515impl<'de> ::serde::Deserialize<'de> for FieldValueFactorModifier {
1516 fn deserialize<D__: ::serde::Deserializer<'de>>(
1517 deserializer: D__,
1518 ) -> ::core::result::Result<Self, D__::Error> {
1519 ::oxsearch_core::__private::deserialize_string_enum(
1520 deserializer,
1521 "FieldValueFactorModifier",
1522 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1523 )
1524 }
1525}
1526
1527#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1528#[non_exhaustive]
1529pub struct FieldValueFactorScoreFunction {
1530 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1532 pub field: ::core::option::Option<crate::Field>,
1533 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1535 pub factor: ::core::option::Option<f64>,
1536 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1539 pub missing: ::core::option::Option<f64>,
1540 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1542 pub modifier: ::core::option::Option<crate::query_dsl::FieldValueFactorModifier>,
1543}
1544
1545impl FieldValueFactorScoreFunction {
1546 pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
1548 Self {
1549 field: ::core::option::Option::Some(field.into()),
1550 factor: ::core::option::Option::None,
1551 missing: ::core::option::Option::None,
1552 modifier: ::core::option::Option::None,
1553 }
1554 }
1555}
1556
1557impl FieldValueFactorScoreFunction {
1558 pub fn factor(mut self, value: f64) -> Self {
1560 self.factor = ::core::option::Option::Some(value.into());
1561 self
1562 }
1563 pub fn missing(mut self, value: f64) -> Self {
1565 self.missing = ::core::option::Option::Some(value.into());
1566 self
1567 }
1568 pub fn modifier(
1570 mut self,
1571 value: impl ::core::convert::Into<crate::query_dsl::FieldValueFactorModifier>,
1572 ) -> Self {
1573 self.modifier = ::core::option::Option::Some(value.into());
1574 self
1575 }
1576}
1577
1578#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1579#[non_exhaustive]
1580pub enum FunctionBoostMode {
1581 Multiply,
1583 Replace,
1586 Sum,
1588 Avg,
1590 Max,
1592 Min,
1594 Raw(::std::string::String),
1596}
1597
1598impl FunctionBoostMode {
1599 pub fn as_str(&self) -> &str {
1601 match self {
1602 Self::Multiply => "multiply",
1603 Self::Replace => "replace",
1604 Self::Sum => "sum",
1605 Self::Avg => "avg",
1606 Self::Max => "max",
1607 Self::Min => "min",
1608 Self::Raw(value) => value,
1609 }
1610 }
1611
1612 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1614 match value {
1615 "multiply" => ::core::option::Option::Some(Self::Multiply),
1616 "replace" => ::core::option::Option::Some(Self::Replace),
1617 "sum" => ::core::option::Option::Some(Self::Sum),
1618 "avg" => ::core::option::Option::Some(Self::Avg),
1619 "max" => ::core::option::Option::Some(Self::Max),
1620 "min" => ::core::option::Option::Some(Self::Min),
1621 _ => ::core::option::Option::None,
1622 }
1623 }
1624}
1625
1626impl ::serde::Serialize for FunctionBoostMode {
1627 fn serialize<S__: ::serde::Serializer>(
1628 &self,
1629 serializer: S__,
1630 ) -> ::core::result::Result<S__::Ok, S__::Error> {
1631 serializer.serialize_str(self.as_str())
1632 }
1633}
1634
1635impl<'de> ::serde::Deserialize<'de> for FunctionBoostMode {
1636 fn deserialize<D__: ::serde::Deserializer<'de>>(
1637 deserializer: D__,
1638 ) -> ::core::result::Result<Self, D__::Error> {
1639 ::oxsearch_core::__private::deserialize_string_enum(
1640 deserializer,
1641 "FunctionBoostMode",
1642 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1643 )
1644 }
1645}
1646
1647#[derive(Clone, Debug, PartialEq)]
1649#[non_exhaustive]
1650pub enum FunctionScoreContainerVariant {
1651 Exp(crate::query_dsl::DecayFunction),
1653 Gauss(crate::query_dsl::DecayFunction),
1655 Linear(crate::query_dsl::DecayFunction),
1657 FieldValueFactor(crate::query_dsl::FieldValueFactorScoreFunction),
1660 RandomScore(crate::query_dsl::RandomScoreFunction),
1663 ScriptScore(crate::query_dsl::ScriptScoreFunction),
1665 Raw(::serde_json::Value),
1667}
1668
1669impl FunctionScoreContainerVariant {
1670 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
1672 &self,
1673 map: &mut M__,
1674 ) -> ::core::result::Result<(), M__::Error> {
1675 match self {
1676 Self::Exp(value) => map.serialize_entry("exp", value),
1677 Self::Gauss(value) => map.serialize_entry("gauss", value),
1678 Self::Linear(value) => map.serialize_entry("linear", value),
1679 Self::FieldValueFactor(value) => map.serialize_entry("field_value_factor", value),
1680 Self::RandomScore(value) => map.serialize_entry("random_score", value),
1681 Self::ScriptScore(value) => map.serialize_entry("script_score", value),
1682 Self::Raw(value) => match value {
1683 ::serde_json::Value::Object(entries) => {
1684 for (key, value) in entries {
1685 map.serialize_entry(key, value)?;
1686 }
1687 ::core::result::Result::Ok(())
1688 }
1689 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
1690 "a raw variant must be an object",
1691 )),
1692 },
1693 }
1694 }
1695}
1696
1697impl ::serde::Serialize for FunctionScoreContainerVariant {
1698 fn serialize<S__: ::serde::Serializer>(
1699 &self,
1700 serializer: S__,
1701 ) -> ::core::result::Result<S__::Ok, S__::Error> {
1702 match self {
1703 Self::Exp(value) => {
1704 ::oxsearch_core::__private::serialize_variant(serializer, "exp", value)
1705 }
1706 Self::Gauss(value) => {
1707 ::oxsearch_core::__private::serialize_variant(serializer, "gauss", value)
1708 }
1709 Self::Linear(value) => {
1710 ::oxsearch_core::__private::serialize_variant(serializer, "linear", value)
1711 }
1712 Self::FieldValueFactor(value) => ::oxsearch_core::__private::serialize_variant(
1713 serializer,
1714 "field_value_factor",
1715 value,
1716 ),
1717 Self::RandomScore(value) => {
1718 ::oxsearch_core::__private::serialize_variant(serializer, "random_score", value)
1719 }
1720 Self::ScriptScore(value) => {
1721 ::oxsearch_core::__private::serialize_variant(serializer, "script_score", value)
1722 }
1723 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
1724 }
1725 }
1726}
1727
1728impl<'de> ::serde::Deserialize<'de> for FunctionScoreContainerVariant {
1729 fn deserialize<D__: ::serde::Deserializer<'de>>(
1730 deserializer: D__,
1731 ) -> ::core::result::Result<Self, D__::Error> {
1732 ::oxsearch_core::__private::deserialize_container(deserializer)
1733 }
1734}
1735
1736impl<'de> ::oxsearch_core::__private::Container<'de> for FunctionScoreContainerVariant {
1737 const NAME: &'static str = "FunctionScoreContainerVariant";
1738 fn variant<A__: ::serde::de::MapAccess<'de>>(
1739 key: &str,
1740 map: &mut A__,
1741 ) -> ::core::result::Result<Self, A__::Error> {
1742 ::core::result::Result::Ok(match key {
1743 "exp" => Self::Exp(map.next_value()?),
1744 "gauss" => Self::Gauss(map.next_value()?),
1745 "linear" => Self::Linear(map.next_value()?),
1746 "field_value_factor" => Self::FieldValueFactor(map.next_value()?),
1747 "random_score" => Self::RandomScore(map.next_value()?),
1748 "script_score" => Self::ScriptScore(map.next_value()?),
1749 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
1750 key,
1751 map.next_value()?,
1752 )),
1753 })
1754 }
1755}
1756
1757impl ::core::convert::From<crate::query_dsl::FieldValueFactorScoreFunction>
1758 for FunctionScoreContainerVariant
1759{
1760 fn from(value: crate::query_dsl::FieldValueFactorScoreFunction) -> Self {
1761 Self::FieldValueFactor(value)
1762 }
1763}
1764
1765impl ::core::convert::From<crate::query_dsl::RandomScoreFunction>
1766 for FunctionScoreContainerVariant
1767{
1768 fn from(value: crate::query_dsl::RandomScoreFunction) -> Self {
1769 Self::RandomScore(value)
1770 }
1771}
1772
1773impl ::core::convert::From<crate::query_dsl::ScriptScoreFunction>
1774 for FunctionScoreContainerVariant
1775{
1776 fn from(value: crate::query_dsl::ScriptScoreFunction) -> Self {
1777 Self::ScriptScore(value)
1778 }
1779}
1780
1781#[derive(Clone, Debug, PartialEq)]
1782#[non_exhaustive]
1783pub struct FunctionScoreContainer {
1784 pub filter: ::core::option::Option<crate::query_dsl::QueryContainer>,
1785 pub weight: ::core::option::Option<f64>,
1786 pub name: ::core::option::Option<::std::string::String>,
1788 pub variant: ::core::option::Option<crate::query_dsl::FunctionScoreContainerVariant>,
1790}
1791
1792impl FunctionScoreContainer {
1793 pub fn new() -> Self {
1795 Self {
1796 filter: ::core::option::Option::None,
1797 weight: ::core::option::Option::None,
1798 name: ::core::option::Option::None,
1799 variant: ::core::option::Option::None,
1800 }
1801 }
1802}
1803
1804impl FunctionScoreContainer {
1805 pub fn filter(
1807 mut self,
1808 value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
1809 ) -> Self {
1810 self.filter = ::core::option::Option::Some(value.into());
1811 self
1812 }
1813 pub fn weight(mut self, value: f64) -> Self {
1815 self.weight = ::core::option::Option::Some(value.into());
1816 self
1817 }
1818 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1820 self.name = ::core::option::Option::Some(value.into());
1821 self
1822 }
1823 pub fn variant(
1825 mut self,
1826 value: impl ::core::convert::Into<crate::query_dsl::FunctionScoreContainerVariant>,
1827 ) -> Self {
1828 self.variant = ::core::option::Option::Some(value.into());
1829 self
1830 }
1831}
1832
1833impl ::serde::Serialize for FunctionScoreContainer {
1834 fn serialize<S__: ::serde::Serializer>(
1835 &self,
1836 serializer: S__,
1837 ) -> ::core::result::Result<S__::Ok, S__::Error> {
1838 use ::serde::ser::SerializeMap as _;
1839 let mut map = serializer.serialize_map(::core::option::Option::None)?;
1840 if let ::core::option::Option::Some(value) = &self.filter {
1841 map.serialize_entry("filter", value)?;
1842 }
1843 if let ::core::option::Option::Some(value) = &self.weight {
1844 map.serialize_entry("weight", value)?;
1845 }
1846 if let ::core::option::Option::Some(value) = &self.name {
1847 map.serialize_entry("_name", value)?;
1848 }
1849 if let ::core::option::Option::Some(variant) = &self.variant {
1850 variant.serialize_entry(&mut map)?;
1851 }
1852 map.end()
1853 }
1854}
1855
1856impl<'de> ::serde::Deserialize<'de> for FunctionScoreContainer {
1857 fn deserialize<D__: ::serde::Deserializer<'de>>(
1858 deserializer: D__,
1859 ) -> ::core::result::Result<Self, D__::Error> {
1860 struct Fields;
1861 impl<'de> ::serde::de::Visitor<'de> for Fields {
1862 type Value = FunctionScoreContainer;
1863 fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1864 f.write_str("a FunctionScoreContainer object")
1865 }
1866 fn visit_map<A__: ::serde::de::MapAccess<'de>>(
1867 self,
1868 mut map: A__,
1869 ) -> ::core::result::Result<FunctionScoreContainer, A__::Error> {
1870 let mut filter = ::core::option::Option::None;
1871 let mut weight = ::core::option::Option::None;
1872 let mut name = ::core::option::Option::None;
1873 let mut variant__ = ::core::option::Option::None;
1874 while let ::core::option::Option::Some(key) =
1875 map.next_key::<::std::string::String>()?
1876 {
1877 match key.as_str() {
1878 "filter" => filter = ::core::option::Option::Some(map.next_value()?),
1879 "weight" => weight = ::core::option::Option::Some(map.next_value()?),
1880 "_name" => name = ::core::option::Option::Some(map.next_value()?),
1881 _ => {
1882 if variant__.is_some() {
1883 return ::core::result::Result::Err(
1884 ::oxsearch_core::__private::two_variants(
1885 "FunctionScoreContainer",
1886 &key,
1887 ),
1888 );
1889 }
1890 variant__ = ::core::option::Option::Some(<FunctionScoreContainerVariant as ::oxsearch_core::__private::Container<'de>>::variant(&key, &mut map)?);
1891 }
1892 }
1893 }
1894 ::core::result::Result::Ok(FunctionScoreContainer {
1895 filter,
1896 weight,
1897 name,
1898 variant: variant__,
1899 })
1900 }
1901 }
1902 deserializer.deserialize_map(Fields)
1903 }
1904}
1905
1906#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1907#[non_exhaustive]
1908pub enum FunctionScoreMode {
1909 Multiply,
1911 Sum,
1913 Avg,
1915 First,
1917 Max,
1919 Min,
1921 Raw(::std::string::String),
1923}
1924
1925impl FunctionScoreMode {
1926 pub fn as_str(&self) -> &str {
1928 match self {
1929 Self::Multiply => "multiply",
1930 Self::Sum => "sum",
1931 Self::Avg => "avg",
1932 Self::First => "first",
1933 Self::Max => "max",
1934 Self::Min => "min",
1935 Self::Raw(value) => value,
1936 }
1937 }
1938
1939 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1941 match value {
1942 "multiply" => ::core::option::Option::Some(Self::Multiply),
1943 "sum" => ::core::option::Option::Some(Self::Sum),
1944 "avg" => ::core::option::Option::Some(Self::Avg),
1945 "first" => ::core::option::Option::Some(Self::First),
1946 "max" => ::core::option::Option::Some(Self::Max),
1947 "min" => ::core::option::Option::Some(Self::Min),
1948 _ => ::core::option::Option::None,
1949 }
1950 }
1951}
1952
1953impl ::serde::Serialize for FunctionScoreMode {
1954 fn serialize<S__: ::serde::Serializer>(
1955 &self,
1956 serializer: S__,
1957 ) -> ::core::result::Result<S__::Ok, S__::Error> {
1958 serializer.serialize_str(self.as_str())
1959 }
1960}
1961
1962impl<'de> ::serde::Deserialize<'de> for FunctionScoreMode {
1963 fn deserialize<D__: ::serde::Deserializer<'de>>(
1964 deserializer: D__,
1965 ) -> ::core::result::Result<Self, D__::Error> {
1966 ::oxsearch_core::__private::deserialize_string_enum(
1967 deserializer,
1968 "FunctionScoreMode",
1969 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1970 )
1971 }
1972}
1973
1974#[derive(Clone, Debug, PartialEq)]
1975#[non_exhaustive]
1976pub struct FunctionScoreQuery {
1977 pub boost: ::core::option::Option<f32>,
1982 pub name: ::core::option::Option<::std::string::String>,
1983 pub boost_mode: ::core::option::Option<crate::query_dsl::FunctionBoostMode>,
1985 pub functions:
1987 ::core::option::Option<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
1988 pub max_boost: ::core::option::Option<f64>,
1990 pub min_score: ::core::option::Option<f64>,
1992 pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
1994 pub score_mode: ::core::option::Option<crate::query_dsl::FunctionScoreMode>,
1996}
1997
1998impl FunctionScoreQuery {
1999 pub fn new() -> Self {
2001 Self {
2002 boost: ::core::option::Option::None,
2003 name: ::core::option::Option::None,
2004 boost_mode: ::core::option::Option::None,
2005 functions: ::core::option::Option::None,
2006 max_boost: ::core::option::Option::None,
2007 min_score: ::core::option::Option::None,
2008 query: ::core::option::Option::None,
2009 score_mode: ::core::option::Option::None,
2010 }
2011 }
2012}
2013
2014impl FunctionScoreQuery {
2015 pub fn boost(mut self, value: f32) -> Self {
2017 self.boost = ::core::option::Option::Some(value.into());
2018 self
2019 }
2020 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2022 self.name = ::core::option::Option::Some(value.into());
2023 self
2024 }
2025 pub fn boost_mode(
2027 mut self,
2028 value: impl ::core::convert::Into<crate::query_dsl::FunctionBoostMode>,
2029 ) -> Self {
2030 self.boost_mode = ::core::option::Option::Some(value.into());
2031 self
2032 }
2033 pub fn functions(
2035 mut self,
2036 value: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
2037 ) -> Self {
2038 self.functions = ::core::option::Option::Some(value.into());
2039 self
2040 }
2041 pub fn max_boost(mut self, value: f64) -> Self {
2043 self.max_boost = ::core::option::Option::Some(value.into());
2044 self
2045 }
2046 pub fn min_score(mut self, value: f64) -> Self {
2048 self.min_score = ::core::option::Option::Some(value.into());
2049 self
2050 }
2051 pub fn query(
2053 mut self,
2054 value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
2055 ) -> Self {
2056 self.query = ::core::option::Option::Some(value.into());
2057 self
2058 }
2059 pub fn score_mode(
2061 mut self,
2062 value: impl ::core::convert::Into<crate::query_dsl::FunctionScoreMode>,
2063 ) -> Self {
2064 self.score_mode = ::core::option::Option::Some(value.into());
2065 self
2066 }
2067}
2068
2069#[derive(::serde::Serialize, ::serde::Deserialize)]
2070#[serde(remote = "FunctionScoreQuery")]
2071struct FunctionScoreQueryDef {
2072 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2077 boost: ::core::option::Option<f32>,
2078 #[serde(
2079 rename = "_name",
2080 skip_serializing_if = "::core::option::Option::is_none"
2081 )]
2082 name: ::core::option::Option<::std::string::String>,
2083 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2085 boost_mode: ::core::option::Option<crate::query_dsl::FunctionBoostMode>,
2086 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2088 functions: ::core::option::Option<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
2089 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2091 max_boost: ::core::option::Option<f64>,
2092 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2094 min_score: ::core::option::Option<f64>,
2095 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2097 query: ::core::option::Option<crate::query_dsl::QueryContainer>,
2098 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2100 score_mode: ::core::option::Option<crate::query_dsl::FunctionScoreMode>,
2101}
2102
2103impl ::serde::Serialize for FunctionScoreQuery {
2104 fn serialize<S__: ::serde::Serializer>(
2105 &self,
2106 serializer: S__,
2107 ) -> ::core::result::Result<S__::Ok, S__::Error> {
2108 if let (::core::option::Option::Some(short), true) = (
2109 &self.functions,
2110 self.boost.is_none()
2111 && self.name.is_none()
2112 && self.boost_mode.is_none()
2113 && self.max_boost.is_none()
2114 && self.min_score.is_none()
2115 && self.query.is_none()
2116 && self.score_mode.is_none(),
2117 ) {
2118 return ::serde::Serialize::serialize(short, serializer);
2119 }
2120 FunctionScoreQueryDef::serialize(self, serializer)
2121 }
2122}
2123
2124impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FunctionScoreQuery {
2125 type Short = ::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>;
2126 fn from_short(short: ::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>) -> Self {
2127 Self {
2128 boost: ::core::option::Option::None,
2129 name: ::core::option::Option::None,
2130 boost_mode: ::core::option::Option::None,
2131 functions: ::core::option::Option::Some(short),
2132 max_boost: ::core::option::Option::None,
2133 min_score: ::core::option::Option::None,
2134 query: ::core::option::Option::None,
2135 score_mode: ::core::option::Option::None,
2136 }
2137 }
2138 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
2139 deserializer: D__,
2140 ) -> ::core::result::Result<Self, D__::Error> {
2141 FunctionScoreQueryDef::deserialize(deserializer)
2142 }
2143}
2144
2145impl<'de> ::serde::Deserialize<'de> for FunctionScoreQuery {
2146 fn deserialize<D__: ::serde::Deserializer<'de>>(
2147 deserializer: D__,
2148 ) -> ::core::result::Result<Self, D__::Error> {
2149 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
2150 }
2151}
2152
2153#[derive(Clone, Debug, PartialEq)]
2154#[non_exhaustive]
2155pub enum FuzzyQueryValue {
2156 String(::std::string::String),
2158 Double(f64),
2160 Bool(bool),
2162}
2163
2164impl ::serde::Serialize for FuzzyQueryValue {
2165 fn serialize<S__: ::serde::Serializer>(
2166 &self,
2167 serializer: S__,
2168 ) -> ::core::result::Result<S__::Ok, S__::Error> {
2169 match self {
2170 Self::String(value) => ::serde::Serialize::serialize(value, serializer),
2171 Self::Double(value) => ::serde::Serialize::serialize(value, serializer),
2172 Self::Bool(value) => ::serde::Serialize::serialize(value, serializer),
2173 }
2174 }
2175}
2176
2177impl<'de> ::serde::Deserialize<'de> for FuzzyQueryValue {
2178 fn deserialize<D__: ::serde::Deserializer<'de>>(
2179 deserializer: D__,
2180 ) -> ::core::result::Result<Self, D__::Error> {
2181 struct Shape;
2182 impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2183 type Value = FuzzyQueryValue;
2184 const EXPECTING: &'static str = "FuzzyQueryValue: boolean or number or string";
2185 fn visit<V__: ::serde::Deserializer<'de>>(
2186 self,
2187 kind: ::oxsearch_core::__private::Kind,
2188 value: V__,
2189 ) -> ::core::result::Result<Self::Value, V__::Error> {
2190 match kind {
2191 ::oxsearch_core::__private::Kind::Bool => {
2192 <bool as ::serde::Deserialize>::deserialize(value)
2193 .map(FuzzyQueryValue::Bool)
2194 }
2195 ::oxsearch_core::__private::Kind::Number => {
2196 <f64 as ::serde::Deserialize>::deserialize(value)
2197 .map(FuzzyQueryValue::Double)
2198 }
2199 ::oxsearch_core::__private::Kind::String => {
2200 <::std::string::String as ::serde::Deserialize>::deserialize(value)
2201 .map(FuzzyQueryValue::String)
2202 }
2203 _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2204 format_args!("FuzzyQueryValue can't be {kind:?}"),
2205 )),
2206 }
2207 }
2208 }
2209 ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2210 }
2211}
2212
2213impl ::core::convert::From<::std::string::String> for FuzzyQueryValue {
2214 fn from(value: ::std::string::String) -> Self {
2215 Self::String(value)
2216 }
2217}
2218
2219impl ::core::convert::From<f64> for FuzzyQueryValue {
2220 fn from(value: f64) -> Self {
2221 Self::Double(value)
2222 }
2223}
2224
2225impl ::core::convert::From<bool> for FuzzyQueryValue {
2226 fn from(value: bool) -> Self {
2227 Self::Bool(value)
2228 }
2229}
2230
2231impl ::core::convert::From<&str> for FuzzyQueryValue {
2232 fn from(value: &str) -> Self {
2233 Self::String(::std::borrow::ToOwned::to_owned(value))
2234 }
2235}
2236
2237#[derive(Clone, Debug, PartialEq)]
2238#[non_exhaustive]
2239pub struct FuzzyQuery {
2240 pub boost: ::core::option::Option<f32>,
2245 pub name: ::core::option::Option<::std::string::String>,
2246 pub max_expansions: ::core::option::Option<i32>,
2248 pub prefix_length: ::core::option::Option<i32>,
2250 pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
2252 pub transpositions: ::core::option::Option<bool>,
2254 pub fuzziness: ::core::option::Option<crate::Fuzziness>,
2256 pub value: ::core::option::Option<crate::query_dsl::FuzzyQueryValue>,
2258}
2259
2260impl FuzzyQuery {
2261 pub fn new(value: impl ::core::convert::Into<crate::query_dsl::FuzzyQueryValue>) -> Self {
2263 Self {
2264 boost: ::core::option::Option::None,
2265 name: ::core::option::Option::None,
2266 max_expansions: ::core::option::Option::None,
2267 prefix_length: ::core::option::Option::None,
2268 rewrite: ::core::option::Option::None,
2269 transpositions: ::core::option::Option::None,
2270 fuzziness: ::core::option::Option::None,
2271 value: ::core::option::Option::Some(value.into()),
2272 }
2273 }
2274}
2275
2276impl FuzzyQuery {
2277 pub fn boost(mut self, value: f32) -> Self {
2279 self.boost = ::core::option::Option::Some(value.into());
2280 self
2281 }
2282 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2284 self.name = ::core::option::Option::Some(value.into());
2285 self
2286 }
2287 pub fn max_expansions(mut self, value: i32) -> Self {
2289 self.max_expansions = ::core::option::Option::Some(value.into());
2290 self
2291 }
2292 pub fn prefix_length(mut self, value: i32) -> Self {
2294 self.prefix_length = ::core::option::Option::Some(value.into());
2295 self
2296 }
2297 pub fn rewrite(
2299 mut self,
2300 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
2301 ) -> Self {
2302 self.rewrite = ::core::option::Option::Some(value.into());
2303 self
2304 }
2305 pub fn transpositions(mut self, value: bool) -> Self {
2307 self.transpositions = ::core::option::Option::Some(value.into());
2308 self
2309 }
2310 pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
2312 self.fuzziness = ::core::option::Option::Some(value.into());
2313 self
2314 }
2315}
2316
2317#[derive(::serde::Serialize, ::serde::Deserialize)]
2318#[serde(remote = "FuzzyQuery")]
2319struct FuzzyQueryDef {
2320 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2325 boost: ::core::option::Option<f32>,
2326 #[serde(
2327 rename = "_name",
2328 skip_serializing_if = "::core::option::Option::is_none"
2329 )]
2330 name: ::core::option::Option<::std::string::String>,
2331 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2333 max_expansions: ::core::option::Option<i32>,
2334 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2336 prefix_length: ::core::option::Option<i32>,
2337 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2339 rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
2340 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2342 transpositions: ::core::option::Option<bool>,
2343 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2345 fuzziness: ::core::option::Option<crate::Fuzziness>,
2346 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2348 value: ::core::option::Option<crate::query_dsl::FuzzyQueryValue>,
2349}
2350
2351impl ::serde::Serialize for FuzzyQuery {
2352 fn serialize<S__: ::serde::Serializer>(
2353 &self,
2354 serializer: S__,
2355 ) -> ::core::result::Result<S__::Ok, S__::Error> {
2356 if let (::core::option::Option::Some(short), true) = (
2357 &self.value,
2358 self.boost.is_none()
2359 && self.name.is_none()
2360 && self.max_expansions.is_none()
2361 && self.prefix_length.is_none()
2362 && self.rewrite.is_none()
2363 && self.transpositions.is_none()
2364 && self.fuzziness.is_none(),
2365 ) {
2366 return ::serde::Serialize::serialize(short, serializer);
2367 }
2368 FuzzyQueryDef::serialize(self, serializer)
2369 }
2370}
2371
2372impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FuzzyQuery {
2373 type Short = crate::query_dsl::FuzzyQueryValue;
2374 fn from_short(short: crate::query_dsl::FuzzyQueryValue) -> Self {
2375 Self {
2376 boost: ::core::option::Option::None,
2377 name: ::core::option::Option::None,
2378 max_expansions: ::core::option::Option::None,
2379 prefix_length: ::core::option::Option::None,
2380 rewrite: ::core::option::Option::None,
2381 transpositions: ::core::option::Option::None,
2382 fuzziness: ::core::option::Option::None,
2383 value: ::core::option::Option::Some(short),
2384 }
2385 }
2386 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
2387 deserializer: D__,
2388 ) -> ::core::result::Result<Self, D__::Error> {
2389 FuzzyQueryDef::deserialize(deserializer)
2390 }
2391}
2392
2393impl<'de> ::serde::Deserialize<'de> for FuzzyQuery {
2394 fn deserialize<D__: ::serde::Deserializer<'de>>(
2395 deserializer: D__,
2396 ) -> ::core::result::Result<Self, D__::Error> {
2397 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
2398 }
2399}
2400
2401#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2402#[serde(try_from = "GeoBoundingBoxQueryRepr", into = "GeoBoundingBoxQueryRepr")]
2403#[non_exhaustive]
2404pub struct GeoBoundingBoxQuery {
2405 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2410 pub boost: ::core::option::Option<f32>,
2411 #[serde(
2412 rename = "_name",
2413 skip_serializing_if = "::core::option::Option::is_none"
2414 )]
2415 pub name: ::core::option::Option<::std::string::String>,
2416 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2417 pub r#type: ::core::option::Option<crate::query_dsl::GeoExecution>,
2418 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2421 pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2422 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2425 pub ignore_unmapped: ::core::option::Option<bool>,
2426 pub field: crate::Field,
2428 pub bounding_box: crate::GeoBounds,
2430}
2431
2432impl GeoBoundingBoxQuery {
2433 pub fn new(
2435 field: impl ::core::convert::Into<crate::Field>,
2436 bounding_box: impl ::core::convert::Into<crate::GeoBounds>,
2437 ) -> Self {
2438 Self {
2439 boost: ::core::option::Option::None,
2440 name: ::core::option::Option::None,
2441 r#type: ::core::option::Option::None,
2442 validation_method: ::core::option::Option::None,
2443 ignore_unmapped: ::core::option::Option::None,
2444 field: field.into(),
2445 bounding_box: bounding_box.into(),
2446 }
2447 }
2448}
2449
2450impl GeoBoundingBoxQuery {
2451 pub fn boost(mut self, value: f32) -> Self {
2453 self.boost = ::core::option::Option::Some(value.into());
2454 self
2455 }
2456 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2458 self.name = ::core::option::Option::Some(value.into());
2459 self
2460 }
2461 pub fn r#type(
2463 mut self,
2464 value: impl ::core::convert::Into<crate::query_dsl::GeoExecution>,
2465 ) -> Self {
2466 self.r#type = ::core::option::Option::Some(value.into());
2467 self
2468 }
2469 pub fn validation_method(
2471 mut self,
2472 value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
2473 ) -> Self {
2474 self.validation_method = ::core::option::Option::Some(value.into());
2475 self
2476 }
2477 pub fn ignore_unmapped(mut self, value: bool) -> Self {
2479 self.ignore_unmapped = ::core::option::Option::Some(value.into());
2480 self
2481 }
2482}
2483
2484#[derive(::serde::Serialize, ::serde::Deserialize)]
2485struct GeoBoundingBoxQueryRepr {
2486 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2491 boost: ::core::option::Option<f32>,
2492 #[serde(
2493 rename = "_name",
2494 skip_serializing_if = "::core::option::Option::is_none"
2495 )]
2496 name: ::core::option::Option<::std::string::String>,
2497 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2498 r#type: ::core::option::Option<crate::query_dsl::GeoExecution>,
2499 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2502 validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2503 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2506 ignore_unmapped: ::core::option::Option<bool>,
2507 #[serde(flatten)]
2508 keyed__: ::indexmap::IndexMap<crate::Field, crate::GeoBounds>,
2509}
2510
2511impl ::core::convert::TryFrom<GeoBoundingBoxQueryRepr> for GeoBoundingBoxQuery {
2512 type Error = ::std::string::String;
2513 fn try_from(repr: GeoBoundingBoxQueryRepr) -> ::core::result::Result<Self, Self::Error> {
2514 let mut keyed = repr.keyed__.into_iter();
2515 match (keyed.next(), keyed.next()) {
2516 (::core::option::Option::Some((field, bounding_box)), ::core::option::Option::None) => {
2517 ::core::result::Result::Ok(Self {
2518 boost: repr.boost,
2519 name: repr.name,
2520 r#type: repr.r#type,
2521 validation_method: repr.validation_method,
2522 ignore_unmapped: repr.ignore_unmapped,
2523 field,
2524 bounding_box,
2525 })
2526 }
2527 _ => ::core::result::Result::Err(::std::string::String::from(
2528 "GeoBoundingBoxQuery needs exactly one property keyed by its field",
2529 )),
2530 }
2531 }
2532}
2533
2534impl ::core::convert::From<GeoBoundingBoxQuery> for GeoBoundingBoxQueryRepr {
2535 fn from(value: GeoBoundingBoxQuery) -> Self {
2536 let mut keyed__ = ::indexmap::IndexMap::new();
2537 keyed__.insert(value.field, value.bounding_box);
2538 Self {
2539 boost: value.boost,
2540 name: value.name,
2541 r#type: value.r#type,
2542 validation_method: value.validation_method,
2543 ignore_unmapped: value.ignore_unmapped,
2544 keyed__,
2545 }
2546 }
2547}
2548
2549#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2550#[serde(try_from = "GeoDecayFunctionRepr", into = "GeoDecayFunctionRepr")]
2551#[non_exhaustive]
2552pub struct GeoDecayFunction {
2553 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2555 pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
2556 pub field: crate::Field,
2558 pub placement: crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
2560}
2561
2562impl GeoDecayFunction {
2563 pub fn new(
2565 field: impl ::core::convert::Into<crate::Field>,
2566 placement: impl ::core::convert::Into<
2567 crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
2568 >,
2569 ) -> Self {
2570 Self {
2571 multi_value_mode: ::core::option::Option::None,
2572 field: field.into(),
2573 placement: placement.into(),
2574 }
2575 }
2576}
2577
2578impl GeoDecayFunction {
2579 pub fn multi_value_mode(
2581 mut self,
2582 value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
2583 ) -> Self {
2584 self.multi_value_mode = ::core::option::Option::Some(value.into());
2585 self
2586 }
2587}
2588
2589#[derive(::serde::Serialize, ::serde::Deserialize)]
2590struct GeoDecayFunctionRepr {
2591 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2593 multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
2594 #[serde(flatten)]
2595 keyed__: ::indexmap::IndexMap<
2596 crate::Field,
2597 crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
2598 >,
2599}
2600
2601impl ::core::convert::TryFrom<GeoDecayFunctionRepr> for GeoDecayFunction {
2602 type Error = ::std::string::String;
2603 fn try_from(repr: GeoDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
2604 let mut keyed = repr.keyed__.into_iter();
2605 match (keyed.next(), keyed.next()) {
2606 (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
2607 ::core::result::Result::Ok(Self {
2608 multi_value_mode: repr.multi_value_mode,
2609 field,
2610 placement,
2611 })
2612 }
2613 _ => ::core::result::Result::Err(::std::string::String::from(
2614 "GeoDecayFunction needs exactly one property keyed by its field",
2615 )),
2616 }
2617 }
2618}
2619
2620impl ::core::convert::From<GeoDecayFunction> for GeoDecayFunctionRepr {
2621 fn from(value: GeoDecayFunction) -> Self {
2622 let mut keyed__ = ::indexmap::IndexMap::new();
2623 keyed__.insert(value.field, value.placement);
2624 Self {
2625 multi_value_mode: value.multi_value_mode,
2626 keyed__,
2627 }
2628 }
2629}
2630
2631#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2632#[non_exhaustive]
2633pub struct GeoDistanceFeatureQuery {
2634 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2639 pub boost: ::core::option::Option<f32>,
2640 #[serde(
2641 rename = "_name",
2642 skip_serializing_if = "::core::option::Option::is_none"
2643 )]
2644 pub name: ::core::option::Option<::std::string::String>,
2645 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2650 pub origin: ::core::option::Option<crate::GeoLocation>,
2651 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2654 pub pivot: ::core::option::Option<crate::Distance>,
2655 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2660 pub field: ::core::option::Option<crate::Field>,
2661}
2662
2663impl GeoDistanceFeatureQuery {
2664 pub fn new(
2666 origin: impl ::core::convert::Into<crate::GeoLocation>,
2667 pivot: impl ::core::convert::Into<crate::Distance>,
2668 field: impl ::core::convert::Into<crate::Field>,
2669 ) -> Self {
2670 Self {
2671 boost: ::core::option::Option::None,
2672 name: ::core::option::Option::None,
2673 origin: ::core::option::Option::Some(origin.into()),
2674 pivot: ::core::option::Option::Some(pivot.into()),
2675 field: ::core::option::Option::Some(field.into()),
2676 }
2677 }
2678}
2679
2680impl GeoDistanceFeatureQuery {
2681 pub fn boost(mut self, value: f32) -> Self {
2683 self.boost = ::core::option::Option::Some(value.into());
2684 self
2685 }
2686 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2688 self.name = ::core::option::Option::Some(value.into());
2689 self
2690 }
2691}
2692
2693#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2694#[serde(try_from = "GeoDistanceQueryRepr", into = "GeoDistanceQueryRepr")]
2695#[non_exhaustive]
2696pub struct GeoDistanceQuery {
2697 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2702 pub boost: ::core::option::Option<f32>,
2703 #[serde(
2704 rename = "_name",
2705 skip_serializing_if = "::core::option::Option::is_none"
2706 )]
2707 pub name: ::core::option::Option<::std::string::String>,
2708 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2711 pub distance: ::core::option::Option<crate::Distance>,
2712 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2715 pub distance_type: ::core::option::Option<crate::GeoDistanceType>,
2716 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2719 pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2720 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2723 pub ignore_unmapped: ::core::option::Option<bool>,
2724 pub field: crate::Field,
2726 pub location: crate::GeoLocation,
2728}
2729
2730impl GeoDistanceQuery {
2731 pub fn new(
2733 distance: impl ::core::convert::Into<crate::Distance>,
2734 field: impl ::core::convert::Into<crate::Field>,
2735 location: impl ::core::convert::Into<crate::GeoLocation>,
2736 ) -> Self {
2737 Self {
2738 boost: ::core::option::Option::None,
2739 name: ::core::option::Option::None,
2740 distance: ::core::option::Option::Some(distance.into()),
2741 distance_type: ::core::option::Option::None,
2742 validation_method: ::core::option::Option::None,
2743 ignore_unmapped: ::core::option::Option::None,
2744 field: field.into(),
2745 location: location.into(),
2746 }
2747 }
2748}
2749
2750impl GeoDistanceQuery {
2751 pub fn boost(mut self, value: f32) -> Self {
2753 self.boost = ::core::option::Option::Some(value.into());
2754 self
2755 }
2756 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2758 self.name = ::core::option::Option::Some(value.into());
2759 self
2760 }
2761 pub fn distance_type(
2763 mut self,
2764 value: impl ::core::convert::Into<crate::GeoDistanceType>,
2765 ) -> Self {
2766 self.distance_type = ::core::option::Option::Some(value.into());
2767 self
2768 }
2769 pub fn validation_method(
2771 mut self,
2772 value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
2773 ) -> Self {
2774 self.validation_method = ::core::option::Option::Some(value.into());
2775 self
2776 }
2777 pub fn ignore_unmapped(mut self, value: bool) -> Self {
2779 self.ignore_unmapped = ::core::option::Option::Some(value.into());
2780 self
2781 }
2782}
2783
2784#[derive(::serde::Serialize, ::serde::Deserialize)]
2785struct GeoDistanceQueryRepr {
2786 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2791 boost: ::core::option::Option<f32>,
2792 #[serde(
2793 rename = "_name",
2794 skip_serializing_if = "::core::option::Option::is_none"
2795 )]
2796 name: ::core::option::Option<::std::string::String>,
2797 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2800 distance: ::core::option::Option<crate::Distance>,
2801 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2804 distance_type: ::core::option::Option<crate::GeoDistanceType>,
2805 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2808 validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2809 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2812 ignore_unmapped: ::core::option::Option<bool>,
2813 #[serde(flatten)]
2814 keyed__: ::indexmap::IndexMap<crate::Field, crate::GeoLocation>,
2815}
2816
2817impl ::core::convert::TryFrom<GeoDistanceQueryRepr> for GeoDistanceQuery {
2818 type Error = ::std::string::String;
2819 fn try_from(repr: GeoDistanceQueryRepr) -> ::core::result::Result<Self, Self::Error> {
2820 let mut keyed = repr.keyed__.into_iter();
2821 match (keyed.next(), keyed.next()) {
2822 (::core::option::Option::Some((field, location)), ::core::option::Option::None) => {
2823 ::core::result::Result::Ok(Self {
2824 boost: repr.boost,
2825 name: repr.name,
2826 distance: repr.distance,
2827 distance_type: repr.distance_type,
2828 validation_method: repr.validation_method,
2829 ignore_unmapped: repr.ignore_unmapped,
2830 field,
2831 location,
2832 })
2833 }
2834 _ => ::core::result::Result::Err(::std::string::String::from(
2835 "GeoDistanceQuery needs exactly one property keyed by its field",
2836 )),
2837 }
2838 }
2839}
2840
2841impl ::core::convert::From<GeoDistanceQuery> for GeoDistanceQueryRepr {
2842 fn from(value: GeoDistanceQuery) -> Self {
2843 let mut keyed__ = ::indexmap::IndexMap::new();
2844 keyed__.insert(value.field, value.location);
2845 Self {
2846 boost: value.boost,
2847 name: value.name,
2848 distance: value.distance,
2849 distance_type: value.distance_type,
2850 validation_method: value.validation_method,
2851 ignore_unmapped: value.ignore_unmapped,
2852 keyed__,
2853 }
2854 }
2855}
2856
2857#[derive(Clone, Debug, PartialEq, Eq, Hash)]
2858#[non_exhaustive]
2859pub enum GeoExecution {
2860 Memory,
2862 Indexed,
2864 Raw(::std::string::String),
2866}
2867
2868impl GeoExecution {
2869 pub fn as_str(&self) -> &str {
2871 match self {
2872 Self::Memory => "memory",
2873 Self::Indexed => "indexed",
2874 Self::Raw(value) => value,
2875 }
2876 }
2877
2878 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
2880 match value {
2881 "memory" => ::core::option::Option::Some(Self::Memory),
2882 "indexed" => ::core::option::Option::Some(Self::Indexed),
2883 _ => ::core::option::Option::None,
2884 }
2885 }
2886}
2887
2888impl ::serde::Serialize for GeoExecution {
2889 fn serialize<S__: ::serde::Serializer>(
2890 &self,
2891 serializer: S__,
2892 ) -> ::core::result::Result<S__::Ok, S__::Error> {
2893 serializer.serialize_str(self.as_str())
2894 }
2895}
2896
2897impl<'de> ::serde::Deserialize<'de> for GeoExecution {
2898 fn deserialize<D__: ::serde::Deserializer<'de>>(
2899 deserializer: D__,
2900 ) -> ::core::result::Result<Self, D__::Error> {
2901 ::oxsearch_core::__private::deserialize_string_enum(deserializer, "GeoExecution", |value| {
2902 Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
2903 })
2904 }
2905}
2906
2907#[derive(Clone, Debug, PartialEq)]
2909#[non_exhaustive]
2910pub enum GeoGridQueryVariant {
2911 Geotile(crate::GeoTile),
2912 Geohash(crate::GeoHash),
2913 Geohex(crate::GeoHexCell),
2914 Raw(::serde_json::Value),
2916}
2917
2918impl GeoGridQueryVariant {
2919 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
2921 &self,
2922 map: &mut M__,
2923 ) -> ::core::result::Result<(), M__::Error> {
2924 match self {
2925 Self::Geotile(value) => map.serialize_entry("geotile", value),
2926 Self::Geohash(value) => map.serialize_entry("geohash", value),
2927 Self::Geohex(value) => map.serialize_entry("geohex", value),
2928 Self::Raw(value) => match value {
2929 ::serde_json::Value::Object(entries) => {
2930 for (key, value) in entries {
2931 map.serialize_entry(key, value)?;
2932 }
2933 ::core::result::Result::Ok(())
2934 }
2935 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
2936 "a raw variant must be an object",
2937 )),
2938 },
2939 }
2940 }
2941}
2942
2943impl ::serde::Serialize for GeoGridQueryVariant {
2944 fn serialize<S__: ::serde::Serializer>(
2945 &self,
2946 serializer: S__,
2947 ) -> ::core::result::Result<S__::Ok, S__::Error> {
2948 match self {
2949 Self::Geotile(value) => {
2950 ::oxsearch_core::__private::serialize_variant(serializer, "geotile", value)
2951 }
2952 Self::Geohash(value) => {
2953 ::oxsearch_core::__private::serialize_variant(serializer, "geohash", value)
2954 }
2955 Self::Geohex(value) => {
2956 ::oxsearch_core::__private::serialize_variant(serializer, "geohex", value)
2957 }
2958 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
2959 }
2960 }
2961}
2962
2963impl<'de> ::serde::Deserialize<'de> for GeoGridQueryVariant {
2964 fn deserialize<D__: ::serde::Deserializer<'de>>(
2965 deserializer: D__,
2966 ) -> ::core::result::Result<Self, D__::Error> {
2967 ::oxsearch_core::__private::deserialize_container(deserializer)
2968 }
2969}
2970
2971impl<'de> ::oxsearch_core::__private::Container<'de> for GeoGridQueryVariant {
2972 const NAME: &'static str = "GeoGridQueryVariant";
2973 fn variant<A__: ::serde::de::MapAccess<'de>>(
2974 key: &str,
2975 map: &mut A__,
2976 ) -> ::core::result::Result<Self, A__::Error> {
2977 ::core::result::Result::Ok(match key {
2978 "geotile" => Self::Geotile(map.next_value()?),
2979 "geohash" => Self::Geohash(map.next_value()?),
2980 "geohex" => Self::Geohex(map.next_value()?),
2981 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
2982 key,
2983 map.next_value()?,
2984 )),
2985 })
2986 }
2987}
2988
2989#[derive(Clone, Debug, PartialEq)]
2990#[non_exhaustive]
2991pub struct GeoGridQuery {
2992 pub boost: ::core::option::Option<f32>,
2997 pub name: ::core::option::Option<::std::string::String>,
2998 pub variant: ::core::option::Option<crate::query_dsl::GeoGridQueryVariant>,
3000}
3001
3002impl GeoGridQuery {
3003 pub fn new() -> Self {
3005 Self {
3006 boost: ::core::option::Option::None,
3007 name: ::core::option::Option::None,
3008 variant: ::core::option::Option::None,
3009 }
3010 }
3011}
3012
3013impl GeoGridQuery {
3014 pub fn boost(mut self, value: f32) -> Self {
3016 self.boost = ::core::option::Option::Some(value.into());
3017 self
3018 }
3019 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3021 self.name = ::core::option::Option::Some(value.into());
3022 self
3023 }
3024 pub fn variant(
3026 mut self,
3027 value: impl ::core::convert::Into<crate::query_dsl::GeoGridQueryVariant>,
3028 ) -> Self {
3029 self.variant = ::core::option::Option::Some(value.into());
3030 self
3031 }
3032}
3033
3034impl ::serde::Serialize for GeoGridQuery {
3035 fn serialize<S__: ::serde::Serializer>(
3036 &self,
3037 serializer: S__,
3038 ) -> ::core::result::Result<S__::Ok, S__::Error> {
3039 use ::serde::ser::SerializeMap as _;
3040 let mut map = serializer.serialize_map(::core::option::Option::None)?;
3041 if let ::core::option::Option::Some(value) = &self.boost {
3042 map.serialize_entry("boost", value)?;
3043 }
3044 if let ::core::option::Option::Some(value) = &self.name {
3045 map.serialize_entry("_name", value)?;
3046 }
3047 if let ::core::option::Option::Some(variant) = &self.variant {
3048 variant.serialize_entry(&mut map)?;
3049 }
3050 map.end()
3051 }
3052}
3053
3054impl<'de> ::serde::Deserialize<'de> for GeoGridQuery {
3055 fn deserialize<D__: ::serde::Deserializer<'de>>(
3056 deserializer: D__,
3057 ) -> ::core::result::Result<Self, D__::Error> {
3058 struct Fields;
3059 impl<'de> ::serde::de::Visitor<'de> for Fields {
3060 type Value = GeoGridQuery;
3061 fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3062 f.write_str("a GeoGridQuery object")
3063 }
3064 fn visit_map<A__: ::serde::de::MapAccess<'de>>(
3065 self,
3066 mut map: A__,
3067 ) -> ::core::result::Result<GeoGridQuery, A__::Error> {
3068 let mut boost = ::core::option::Option::None;
3069 let mut name = ::core::option::Option::None;
3070 let mut variant__ = ::core::option::Option::None;
3071 while let ::core::option::Option::Some(key) =
3072 map.next_key::<::std::string::String>()?
3073 {
3074 match key.as_str() {
3075 "boost" => boost = ::core::option::Option::Some(map.next_value()?),
3076 "_name" => name = ::core::option::Option::Some(map.next_value()?),
3077 _ => {
3078 if variant__.is_some() {
3079 return ::core::result::Result::Err(
3080 ::oxsearch_core::__private::two_variants("GeoGridQuery", &key),
3081 );
3082 }
3083 variant__ = ::core::option::Option::Some(
3084 <GeoGridQueryVariant as ::oxsearch_core::__private::Container<
3085 'de,
3086 >>::variant(&key, &mut map)?,
3087 );
3088 }
3089 }
3090 }
3091 ::core::result::Result::Ok(GeoGridQuery {
3092 boost,
3093 name,
3094 variant: variant__,
3095 })
3096 }
3097 }
3098 deserializer.deserialize_map(Fields)
3099 }
3100}
3101
3102#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3103#[non_exhaustive]
3104pub struct GeoPolygonPoints {
3105 #[serde(default = "::core::default::Default::default")]
3106 pub points: ::std::vec::Vec<crate::GeoLocation>,
3107}
3108
3109impl GeoPolygonPoints {
3110 pub fn new(points: impl ::core::convert::Into<::std::vec::Vec<crate::GeoLocation>>) -> Self {
3112 Self {
3113 points: points.into(),
3114 }
3115 }
3116}
3117
3118impl GeoPolygonPoints {}
3119
3120#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3121#[serde(try_from = "GeoPolygonQueryRepr", into = "GeoPolygonQueryRepr")]
3122#[non_exhaustive]
3123pub struct GeoPolygonQuery {
3124 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3129 pub boost: ::core::option::Option<f32>,
3130 #[serde(
3131 rename = "_name",
3132 skip_serializing_if = "::core::option::Option::is_none"
3133 )]
3134 pub name: ::core::option::Option<::std::string::String>,
3135 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3136 pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
3137 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3138 pub ignore_unmapped: ::core::option::Option<bool>,
3139 pub field: crate::Field,
3141 pub polygon: crate::query_dsl::GeoPolygonPoints,
3143}
3144
3145impl GeoPolygonQuery {
3146 pub fn new(
3148 field: impl ::core::convert::Into<crate::Field>,
3149 polygon: impl ::core::convert::Into<crate::query_dsl::GeoPolygonPoints>,
3150 ) -> Self {
3151 Self {
3152 boost: ::core::option::Option::None,
3153 name: ::core::option::Option::None,
3154 validation_method: ::core::option::Option::None,
3155 ignore_unmapped: ::core::option::Option::None,
3156 field: field.into(),
3157 polygon: polygon.into(),
3158 }
3159 }
3160}
3161
3162impl GeoPolygonQuery {
3163 pub fn boost(mut self, value: f32) -> Self {
3165 self.boost = ::core::option::Option::Some(value.into());
3166 self
3167 }
3168 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3170 self.name = ::core::option::Option::Some(value.into());
3171 self
3172 }
3173 pub fn validation_method(
3175 mut self,
3176 value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
3177 ) -> Self {
3178 self.validation_method = ::core::option::Option::Some(value.into());
3179 self
3180 }
3181 pub fn ignore_unmapped(mut self, value: bool) -> Self {
3183 self.ignore_unmapped = ::core::option::Option::Some(value.into());
3184 self
3185 }
3186}
3187
3188#[derive(::serde::Serialize, ::serde::Deserialize)]
3189struct GeoPolygonQueryRepr {
3190 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3195 boost: ::core::option::Option<f32>,
3196 #[serde(
3197 rename = "_name",
3198 skip_serializing_if = "::core::option::Option::is_none"
3199 )]
3200 name: ::core::option::Option<::std::string::String>,
3201 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3202 validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
3203 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3204 ignore_unmapped: ::core::option::Option<bool>,
3205 #[serde(flatten)]
3206 keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::GeoPolygonPoints>,
3207}
3208
3209impl ::core::convert::TryFrom<GeoPolygonQueryRepr> for GeoPolygonQuery {
3210 type Error = ::std::string::String;
3211 fn try_from(repr: GeoPolygonQueryRepr) -> ::core::result::Result<Self, Self::Error> {
3212 let mut keyed = repr.keyed__.into_iter();
3213 match (keyed.next(), keyed.next()) {
3214 (::core::option::Option::Some((field, polygon)), ::core::option::Option::None) => {
3215 ::core::result::Result::Ok(Self {
3216 boost: repr.boost,
3217 name: repr.name,
3218 validation_method: repr.validation_method,
3219 ignore_unmapped: repr.ignore_unmapped,
3220 field,
3221 polygon,
3222 })
3223 }
3224 _ => ::core::result::Result::Err(::std::string::String::from(
3225 "GeoPolygonQuery needs exactly one property keyed by its field",
3226 )),
3227 }
3228 }
3229}
3230
3231impl ::core::convert::From<GeoPolygonQuery> for GeoPolygonQueryRepr {
3232 fn from(value: GeoPolygonQuery) -> Self {
3233 let mut keyed__ = ::indexmap::IndexMap::new();
3234 keyed__.insert(value.field, value.polygon);
3235 Self {
3236 boost: value.boost,
3237 name: value.name,
3238 validation_method: value.validation_method,
3239 ignore_unmapped: value.ignore_unmapped,
3240 keyed__,
3241 }
3242 }
3243}
3244
3245#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3246#[non_exhaustive]
3247pub struct GeoShapeFieldQuery {
3248 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3249 pub shape: ::core::option::Option<crate::GeoShape>,
3250 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3252 pub indexed_shape: ::core::option::Option<crate::query_dsl::FieldLookup>,
3253 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3255 pub relation: ::core::option::Option<crate::GeoShapeRelation>,
3256}
3257
3258impl GeoShapeFieldQuery {
3259 pub fn new() -> Self {
3261 Self {
3262 shape: ::core::option::Option::None,
3263 indexed_shape: ::core::option::Option::None,
3264 relation: ::core::option::Option::None,
3265 }
3266 }
3267}
3268
3269impl GeoShapeFieldQuery {
3270 pub fn shape(mut self, value: impl ::core::convert::Into<crate::GeoShape>) -> Self {
3272 self.shape = ::core::option::Option::Some(value.into());
3273 self
3274 }
3275 pub fn indexed_shape(
3277 mut self,
3278 value: impl ::core::convert::Into<crate::query_dsl::FieldLookup>,
3279 ) -> Self {
3280 self.indexed_shape = ::core::option::Option::Some(value.into());
3281 self
3282 }
3283 pub fn relation(mut self, value: impl ::core::convert::Into<crate::GeoShapeRelation>) -> Self {
3285 self.relation = ::core::option::Option::Some(value.into());
3286 self
3287 }
3288}
3289
3290#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3291#[serde(try_from = "GeoShapeQueryRepr", into = "GeoShapeQueryRepr")]
3292#[non_exhaustive]
3293pub struct GeoShapeQuery {
3294 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3299 pub boost: ::core::option::Option<f32>,
3300 #[serde(
3301 rename = "_name",
3302 skip_serializing_if = "::core::option::Option::is_none"
3303 )]
3304 pub name: ::core::option::Option<::std::string::String>,
3305 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3308 pub ignore_unmapped: ::core::option::Option<bool>,
3309 pub field: crate::Field,
3311 pub shape: crate::query_dsl::GeoShapeFieldQuery,
3313}
3314
3315impl GeoShapeQuery {
3316 pub fn new(
3318 field: impl ::core::convert::Into<crate::Field>,
3319 shape: impl ::core::convert::Into<crate::query_dsl::GeoShapeFieldQuery>,
3320 ) -> Self {
3321 Self {
3322 boost: ::core::option::Option::None,
3323 name: ::core::option::Option::None,
3324 ignore_unmapped: ::core::option::Option::None,
3325 field: field.into(),
3326 shape: shape.into(),
3327 }
3328 }
3329}
3330
3331impl GeoShapeQuery {
3332 pub fn boost(mut self, value: f32) -> Self {
3334 self.boost = ::core::option::Option::Some(value.into());
3335 self
3336 }
3337 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3339 self.name = ::core::option::Option::Some(value.into());
3340 self
3341 }
3342 pub fn ignore_unmapped(mut self, value: bool) -> Self {
3344 self.ignore_unmapped = ::core::option::Option::Some(value.into());
3345 self
3346 }
3347}
3348
3349#[derive(::serde::Serialize, ::serde::Deserialize)]
3350struct GeoShapeQueryRepr {
3351 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3356 boost: ::core::option::Option<f32>,
3357 #[serde(
3358 rename = "_name",
3359 skip_serializing_if = "::core::option::Option::is_none"
3360 )]
3361 name: ::core::option::Option<::std::string::String>,
3362 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3365 ignore_unmapped: ::core::option::Option<bool>,
3366 #[serde(flatten)]
3367 keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::GeoShapeFieldQuery>,
3368}
3369
3370impl ::core::convert::TryFrom<GeoShapeQueryRepr> for GeoShapeQuery {
3371 type Error = ::std::string::String;
3372 fn try_from(repr: GeoShapeQueryRepr) -> ::core::result::Result<Self, Self::Error> {
3373 let mut keyed = repr.keyed__.into_iter();
3374 match (keyed.next(), keyed.next()) {
3375 (::core::option::Option::Some((field, shape)), ::core::option::Option::None) => {
3376 ::core::result::Result::Ok(Self {
3377 boost: repr.boost,
3378 name: repr.name,
3379 ignore_unmapped: repr.ignore_unmapped,
3380 field,
3381 shape,
3382 })
3383 }
3384 _ => ::core::result::Result::Err(::std::string::String::from(
3385 "GeoShapeQuery needs exactly one property keyed by its field",
3386 )),
3387 }
3388 }
3389}
3390
3391impl ::core::convert::From<GeoShapeQuery> for GeoShapeQueryRepr {
3392 fn from(value: GeoShapeQuery) -> Self {
3393 let mut keyed__ = ::indexmap::IndexMap::new();
3394 keyed__.insert(value.field, value.shape);
3395 Self {
3396 boost: value.boost,
3397 name: value.name,
3398 ignore_unmapped: value.ignore_unmapped,
3399 keyed__,
3400 }
3401 }
3402}
3403
3404#[derive(Clone, Debug, PartialEq, Eq, Hash)]
3405#[non_exhaustive]
3406pub enum GeoValidationMethod {
3407 Coerce,
3409 IgnoreMalformed,
3411 Strict,
3413 Raw(::std::string::String),
3415}
3416
3417impl GeoValidationMethod {
3418 pub fn as_str(&self) -> &str {
3420 match self {
3421 Self::Coerce => "coerce",
3422 Self::IgnoreMalformed => "ignore_malformed",
3423 Self::Strict => "strict",
3424 Self::Raw(value) => value,
3425 }
3426 }
3427
3428 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
3430 match value {
3431 "coerce" => ::core::option::Option::Some(Self::Coerce),
3432 "ignore_malformed" => ::core::option::Option::Some(Self::IgnoreMalformed),
3433 "strict" => ::core::option::Option::Some(Self::Strict),
3434 _ => ::core::option::Option::None,
3435 }
3436 }
3437}
3438
3439impl ::serde::Serialize for GeoValidationMethod {
3440 fn serialize<S__: ::serde::Serializer>(
3441 &self,
3442 serializer: S__,
3443 ) -> ::core::result::Result<S__::Ok, S__::Error> {
3444 serializer.serialize_str(self.as_str())
3445 }
3446}
3447
3448impl<'de> ::serde::Deserialize<'de> for GeoValidationMethod {
3449 fn deserialize<D__: ::serde::Deserializer<'de>>(
3450 deserializer: D__,
3451 ) -> ::core::result::Result<Self, D__::Error> {
3452 ::oxsearch_core::__private::deserialize_string_enum(
3453 deserializer,
3454 "GeoValidationMethod",
3455 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
3456 )
3457 }
3458}
3459
3460#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3461#[non_exhaustive]
3462pub struct HasChildQuery {
3463 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3468 pub boost: ::core::option::Option<f32>,
3469 #[serde(
3470 rename = "_name",
3471 skip_serializing_if = "::core::option::Option::is_none"
3472 )]
3473 pub name: ::core::option::Option<::std::string::String>,
3474 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3476 pub ignore_unmapped: ::core::option::Option<bool>,
3477 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3479 pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
3480 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3483 pub max_children: ::core::option::Option<i32>,
3484 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3487 pub min_children: ::core::option::Option<i32>,
3488 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3491 pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
3492 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3494 pub score_mode: ::core::option::Option<crate::query_dsl::ChildScoreMode>,
3495 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3497 pub r#type: ::core::option::Option<crate::RelationName>,
3498}
3499
3500impl HasChildQuery {
3501 pub fn new(
3503 query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
3504 r#type: impl ::core::convert::Into<crate::RelationName>,
3505 ) -> Self {
3506 Self {
3507 boost: ::core::option::Option::None,
3508 name: ::core::option::Option::None,
3509 ignore_unmapped: ::core::option::Option::None,
3510 inner_hits: ::core::option::Option::None,
3511 max_children: ::core::option::Option::None,
3512 min_children: ::core::option::Option::None,
3513 query: ::core::option::Option::Some(query.into()),
3514 score_mode: ::core::option::Option::None,
3515 r#type: ::core::option::Option::Some(r#type.into()),
3516 }
3517 }
3518}
3519
3520impl HasChildQuery {
3521 pub fn boost(mut self, value: f32) -> Self {
3523 self.boost = ::core::option::Option::Some(value.into());
3524 self
3525 }
3526 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3528 self.name = ::core::option::Option::Some(value.into());
3529 self
3530 }
3531 pub fn ignore_unmapped(mut self, value: bool) -> Self {
3533 self.ignore_unmapped = ::core::option::Option::Some(value.into());
3534 self
3535 }
3536 pub fn inner_hits(
3538 mut self,
3539 value: impl ::core::convert::Into<crate::search::InnerHits>,
3540 ) -> Self {
3541 self.inner_hits = ::core::option::Option::Some(value.into());
3542 self
3543 }
3544 pub fn max_children(mut self, value: i32) -> Self {
3546 self.max_children = ::core::option::Option::Some(value.into());
3547 self
3548 }
3549 pub fn min_children(mut self, value: i32) -> Self {
3551 self.min_children = ::core::option::Option::Some(value.into());
3552 self
3553 }
3554 pub fn score_mode(
3556 mut self,
3557 value: impl ::core::convert::Into<crate::query_dsl::ChildScoreMode>,
3558 ) -> Self {
3559 self.score_mode = ::core::option::Option::Some(value.into());
3560 self
3561 }
3562}
3563
3564#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3565#[non_exhaustive]
3566pub struct HasParentQuery {
3567 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3572 pub boost: ::core::option::Option<f32>,
3573 #[serde(
3574 rename = "_name",
3575 skip_serializing_if = "::core::option::Option::is_none"
3576 )]
3577 pub name: ::core::option::Option<::std::string::String>,
3578 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3581 pub ignore_unmapped: ::core::option::Option<bool>,
3582 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3584 pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
3585 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3587 pub parent_type: ::core::option::Option<crate::RelationName>,
3588 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3591 pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
3592 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3594 pub score: ::core::option::Option<bool>,
3595}
3596
3597impl HasParentQuery {
3598 pub fn new(
3600 parent_type: impl ::core::convert::Into<crate::RelationName>,
3601 query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
3602 ) -> Self {
3603 Self {
3604 boost: ::core::option::Option::None,
3605 name: ::core::option::Option::None,
3606 ignore_unmapped: ::core::option::Option::None,
3607 inner_hits: ::core::option::Option::None,
3608 parent_type: ::core::option::Option::Some(parent_type.into()),
3609 query: ::core::option::Option::Some(query.into()),
3610 score: ::core::option::Option::None,
3611 }
3612 }
3613}
3614
3615impl HasParentQuery {
3616 pub fn boost(mut self, value: f32) -> Self {
3618 self.boost = ::core::option::Option::Some(value.into());
3619 self
3620 }
3621 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3623 self.name = ::core::option::Option::Some(value.into());
3624 self
3625 }
3626 pub fn ignore_unmapped(mut self, value: bool) -> Self {
3628 self.ignore_unmapped = ::core::option::Option::Some(value.into());
3629 self
3630 }
3631 pub fn inner_hits(
3633 mut self,
3634 value: impl ::core::convert::Into<crate::search::InnerHits>,
3635 ) -> Self {
3636 self.inner_hits = ::core::option::Option::Some(value.into());
3637 self
3638 }
3639 pub fn score(mut self, value: bool) -> Self {
3641 self.score = ::core::option::Option::Some(value.into());
3642 self
3643 }
3644}
3645
3646#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3647#[non_exhaustive]
3648pub struct IdsQuery {
3649 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3654 pub boost: ::core::option::Option<f32>,
3655 #[serde(
3656 rename = "_name",
3657 skip_serializing_if = "::core::option::Option::is_none"
3658 )]
3659 pub name: ::core::option::Option<::std::string::String>,
3660 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3662 pub values: ::core::option::Option<crate::Ids>,
3663}
3664
3665impl IdsQuery {
3666 pub fn new() -> Self {
3668 Self {
3669 boost: ::core::option::Option::None,
3670 name: ::core::option::Option::None,
3671 values: ::core::option::Option::None,
3672 }
3673 }
3674}
3675
3676impl IdsQuery {
3677 pub fn boost(mut self, value: f32) -> Self {
3679 self.boost = ::core::option::Option::Some(value.into());
3680 self
3681 }
3682 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3684 self.name = ::core::option::Option::Some(value.into());
3685 self
3686 }
3687 pub fn values(mut self, value: impl ::core::convert::Into<crate::Ids>) -> Self {
3689 self.values = ::core::option::Option::Some(value.into());
3690 self
3691 }
3692}
3693
3694#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3695#[non_exhaustive]
3696pub struct IntervalsAllOf {
3697 #[serde(default = "::core::default::Default::default")]
3699 pub intervals: ::std::vec::Vec<crate::query_dsl::IntervalsContainer>,
3700 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3703 pub max_gaps: ::core::option::Option<i32>,
3704 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3706 pub ordered: ::core::option::Option<bool>,
3707 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3709 pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
3710}
3711
3712impl IntervalsAllOf {
3713 pub fn new(
3715 intervals: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::IntervalsContainer>>,
3716 ) -> Self {
3717 Self {
3718 intervals: intervals.into(),
3719 max_gaps: ::core::option::Option::None,
3720 ordered: ::core::option::Option::None,
3721 filter: ::core::option::Option::None,
3722 }
3723 }
3724}
3725
3726impl IntervalsAllOf {
3727 pub fn max_gaps(mut self, value: i32) -> Self {
3729 self.max_gaps = ::core::option::Option::Some(value.into());
3730 self
3731 }
3732 pub fn ordered(mut self, value: bool) -> Self {
3734 self.ordered = ::core::option::Option::Some(value.into());
3735 self
3736 }
3737 pub fn filter(
3739 mut self,
3740 value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
3741 ) -> Self {
3742 self.filter = ::core::option::Option::Some(value.into());
3743 self
3744 }
3745}
3746
3747#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3748#[non_exhaustive]
3749pub struct IntervalsAnyOf {
3750 #[serde(default = "::core::default::Default::default")]
3752 pub intervals: ::std::vec::Vec<crate::query_dsl::IntervalsContainer>,
3753 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3755 pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
3756}
3757
3758impl IntervalsAnyOf {
3759 pub fn new(
3761 intervals: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::IntervalsContainer>>,
3762 ) -> Self {
3763 Self {
3764 intervals: intervals.into(),
3765 filter: ::core::option::Option::None,
3766 }
3767 }
3768}
3769
3770impl IntervalsAnyOf {
3771 pub fn filter(
3773 mut self,
3774 value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
3775 ) -> Self {
3776 self.filter = ::core::option::Option::Some(value.into());
3777 self
3778 }
3779}
3780
3781#[derive(Clone, Debug, PartialEq)]
3782#[non_exhaustive]
3783pub enum IntervalsContainer {
3784 AllOf(::std::boxed::Box<crate::query_dsl::IntervalsAllOf>),
3786 AnyOf(::std::boxed::Box<crate::query_dsl::IntervalsAnyOf>),
3788 Fuzzy(crate::query_dsl::IntervalsFuzzy),
3790 Match(::std::boxed::Box<crate::query_dsl::IntervalsMatch>),
3792 Prefix(crate::query_dsl::IntervalsPrefix),
3794 Range(crate::query_dsl::IntervalsRange),
3795 Regexp(crate::query_dsl::IntervalsRegexp),
3796 Wildcard(crate::query_dsl::IntervalsWildcard),
3798 Raw(::serde_json::Value),
3800}
3801
3802impl IntervalsContainer {
3803 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
3805 &self,
3806 map: &mut M__,
3807 ) -> ::core::result::Result<(), M__::Error> {
3808 match self {
3809 Self::AllOf(value) => map.serialize_entry("all_of", value),
3810 Self::AnyOf(value) => map.serialize_entry("any_of", value),
3811 Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
3812 Self::Match(value) => map.serialize_entry("match", value),
3813 Self::Prefix(value) => map.serialize_entry("prefix", value),
3814 Self::Range(value) => map.serialize_entry("range", value),
3815 Self::Regexp(value) => map.serialize_entry("regexp", value),
3816 Self::Wildcard(value) => map.serialize_entry("wildcard", value),
3817 Self::Raw(value) => match value {
3818 ::serde_json::Value::Object(entries) => {
3819 for (key, value) in entries {
3820 map.serialize_entry(key, value)?;
3821 }
3822 ::core::result::Result::Ok(())
3823 }
3824 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
3825 "a raw variant must be an object",
3826 )),
3827 },
3828 }
3829 }
3830}
3831
3832impl ::serde::Serialize for IntervalsContainer {
3833 fn serialize<S__: ::serde::Serializer>(
3834 &self,
3835 serializer: S__,
3836 ) -> ::core::result::Result<S__::Ok, S__::Error> {
3837 match self {
3838 Self::AllOf(value) => {
3839 ::oxsearch_core::__private::serialize_variant(serializer, "all_of", value)
3840 }
3841 Self::AnyOf(value) => {
3842 ::oxsearch_core::__private::serialize_variant(serializer, "any_of", value)
3843 }
3844 Self::Fuzzy(value) => {
3845 ::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
3846 }
3847 Self::Match(value) => {
3848 ::oxsearch_core::__private::serialize_variant(serializer, "match", value)
3849 }
3850 Self::Prefix(value) => {
3851 ::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
3852 }
3853 Self::Range(value) => {
3854 ::oxsearch_core::__private::serialize_variant(serializer, "range", value)
3855 }
3856 Self::Regexp(value) => {
3857 ::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
3858 }
3859 Self::Wildcard(value) => {
3860 ::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
3861 }
3862 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
3863 }
3864 }
3865}
3866
3867impl<'de> ::serde::Deserialize<'de> for IntervalsContainer {
3868 fn deserialize<D__: ::serde::Deserializer<'de>>(
3869 deserializer: D__,
3870 ) -> ::core::result::Result<Self, D__::Error> {
3871 ::oxsearch_core::__private::deserialize_container(deserializer)
3872 }
3873}
3874
3875impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsContainer {
3876 const NAME: &'static str = "IntervalsContainer";
3877 fn variant<A__: ::serde::de::MapAccess<'de>>(
3878 key: &str,
3879 map: &mut A__,
3880 ) -> ::core::result::Result<Self, A__::Error> {
3881 ::core::result::Result::Ok(match key {
3882 "all_of" => Self::AllOf(map.next_value()?),
3883 "any_of" => Self::AnyOf(map.next_value()?),
3884 "fuzzy" => Self::Fuzzy(map.next_value()?),
3885 "match" => Self::Match(map.next_value()?),
3886 "prefix" => Self::Prefix(map.next_value()?),
3887 "range" => Self::Range(map.next_value()?),
3888 "regexp" => Self::Regexp(map.next_value()?),
3889 "wildcard" => Self::Wildcard(map.next_value()?),
3890 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
3891 key,
3892 map.next_value()?,
3893 )),
3894 })
3895 }
3896}
3897
3898impl ::core::convert::From<crate::query_dsl::IntervalsAllOf> for IntervalsContainer {
3899 fn from(value: crate::query_dsl::IntervalsAllOf) -> Self {
3900 Self::AllOf(::std::boxed::Box::new(value))
3901 }
3902}
3903
3904impl ::core::convert::From<crate::query_dsl::IntervalsAnyOf> for IntervalsContainer {
3905 fn from(value: crate::query_dsl::IntervalsAnyOf) -> Self {
3906 Self::AnyOf(::std::boxed::Box::new(value))
3907 }
3908}
3909
3910impl ::core::convert::From<crate::query_dsl::IntervalsFuzzy> for IntervalsContainer {
3911 fn from(value: crate::query_dsl::IntervalsFuzzy) -> Self {
3912 Self::Fuzzy(value)
3913 }
3914}
3915
3916impl ::core::convert::From<crate::query_dsl::IntervalsMatch> for IntervalsContainer {
3917 fn from(value: crate::query_dsl::IntervalsMatch) -> Self {
3918 Self::Match(::std::boxed::Box::new(value))
3919 }
3920}
3921
3922impl ::core::convert::From<crate::query_dsl::IntervalsPrefix> for IntervalsContainer {
3923 fn from(value: crate::query_dsl::IntervalsPrefix) -> Self {
3924 Self::Prefix(value)
3925 }
3926}
3927
3928impl ::core::convert::From<crate::query_dsl::IntervalsRange> for IntervalsContainer {
3929 fn from(value: crate::query_dsl::IntervalsRange) -> Self {
3930 Self::Range(value)
3931 }
3932}
3933
3934impl ::core::convert::From<crate::query_dsl::IntervalsRegexp> for IntervalsContainer {
3935 fn from(value: crate::query_dsl::IntervalsRegexp) -> Self {
3936 Self::Regexp(value)
3937 }
3938}
3939
3940impl ::core::convert::From<crate::query_dsl::IntervalsWildcard> for IntervalsContainer {
3941 fn from(value: crate::query_dsl::IntervalsWildcard) -> Self {
3942 Self::Wildcard(value)
3943 }
3944}
3945
3946#[derive(Clone, Debug, PartialEq)]
3947#[non_exhaustive]
3948pub enum IntervalsFilter {
3949 After(crate::query_dsl::IntervalsContainer),
3951 Before(crate::query_dsl::IntervalsContainer),
3953 ContainedBy(crate::query_dsl::IntervalsContainer),
3955 Containing(crate::query_dsl::IntervalsContainer),
3957 NotContainedBy(crate::query_dsl::IntervalsContainer),
3959 NotContaining(crate::query_dsl::IntervalsContainer),
3961 NotOverlapping(crate::query_dsl::IntervalsContainer),
3963 Overlapping(crate::query_dsl::IntervalsContainer),
3965 Script(crate::Script),
3968 Raw(::serde_json::Value),
3970}
3971
3972impl IntervalsFilter {
3973 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
3975 &self,
3976 map: &mut M__,
3977 ) -> ::core::result::Result<(), M__::Error> {
3978 match self {
3979 Self::After(value) => map.serialize_entry("after", value),
3980 Self::Before(value) => map.serialize_entry("before", value),
3981 Self::ContainedBy(value) => map.serialize_entry("contained_by", value),
3982 Self::Containing(value) => map.serialize_entry("containing", value),
3983 Self::NotContainedBy(value) => map.serialize_entry("not_contained_by", value),
3984 Self::NotContaining(value) => map.serialize_entry("not_containing", value),
3985 Self::NotOverlapping(value) => map.serialize_entry("not_overlapping", value),
3986 Self::Overlapping(value) => map.serialize_entry("overlapping", value),
3987 Self::Script(value) => map.serialize_entry("script", value),
3988 Self::Raw(value) => match value {
3989 ::serde_json::Value::Object(entries) => {
3990 for (key, value) in entries {
3991 map.serialize_entry(key, value)?;
3992 }
3993 ::core::result::Result::Ok(())
3994 }
3995 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
3996 "a raw variant must be an object",
3997 )),
3998 },
3999 }
4000 }
4001}
4002
4003impl ::serde::Serialize for IntervalsFilter {
4004 fn serialize<S__: ::serde::Serializer>(
4005 &self,
4006 serializer: S__,
4007 ) -> ::core::result::Result<S__::Ok, S__::Error> {
4008 match self {
4009 Self::After(value) => {
4010 ::oxsearch_core::__private::serialize_variant(serializer, "after", value)
4011 }
4012 Self::Before(value) => {
4013 ::oxsearch_core::__private::serialize_variant(serializer, "before", value)
4014 }
4015 Self::ContainedBy(value) => {
4016 ::oxsearch_core::__private::serialize_variant(serializer, "contained_by", value)
4017 }
4018 Self::Containing(value) => {
4019 ::oxsearch_core::__private::serialize_variant(serializer, "containing", value)
4020 }
4021 Self::NotContainedBy(value) => {
4022 ::oxsearch_core::__private::serialize_variant(serializer, "not_contained_by", value)
4023 }
4024 Self::NotContaining(value) => {
4025 ::oxsearch_core::__private::serialize_variant(serializer, "not_containing", value)
4026 }
4027 Self::NotOverlapping(value) => {
4028 ::oxsearch_core::__private::serialize_variant(serializer, "not_overlapping", value)
4029 }
4030 Self::Overlapping(value) => {
4031 ::oxsearch_core::__private::serialize_variant(serializer, "overlapping", value)
4032 }
4033 Self::Script(value) => {
4034 ::oxsearch_core::__private::serialize_variant(serializer, "script", value)
4035 }
4036 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
4037 }
4038 }
4039}
4040
4041impl<'de> ::serde::Deserialize<'de> for IntervalsFilter {
4042 fn deserialize<D__: ::serde::Deserializer<'de>>(
4043 deserializer: D__,
4044 ) -> ::core::result::Result<Self, D__::Error> {
4045 ::oxsearch_core::__private::deserialize_container(deserializer)
4046 }
4047}
4048
4049impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsFilter {
4050 const NAME: &'static str = "IntervalsFilter";
4051 fn variant<A__: ::serde::de::MapAccess<'de>>(
4052 key: &str,
4053 map: &mut A__,
4054 ) -> ::core::result::Result<Self, A__::Error> {
4055 ::core::result::Result::Ok(match key {
4056 "after" => Self::After(map.next_value()?),
4057 "before" => Self::Before(map.next_value()?),
4058 "contained_by" => Self::ContainedBy(map.next_value()?),
4059 "containing" => Self::Containing(map.next_value()?),
4060 "not_contained_by" => Self::NotContainedBy(map.next_value()?),
4061 "not_containing" => Self::NotContaining(map.next_value()?),
4062 "not_overlapping" => Self::NotOverlapping(map.next_value()?),
4063 "overlapping" => Self::Overlapping(map.next_value()?),
4064 "script" => Self::Script(map.next_value()?),
4065 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
4066 key,
4067 map.next_value()?,
4068 )),
4069 })
4070 }
4071}
4072
4073impl ::core::convert::From<crate::Script> for IntervalsFilter {
4074 fn from(value: crate::Script) -> Self {
4075 Self::Script(value)
4076 }
4077}
4078
4079#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4080#[non_exhaustive]
4081pub struct IntervalsFuzzy {
4082 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4084 pub analyzer: ::core::option::Option<::std::string::String>,
4085 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4087 pub fuzziness: ::core::option::Option<crate::Fuzziness>,
4088 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4090 pub prefix_length: ::core::option::Option<i32>,
4091 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4093 pub term: ::core::option::Option<::std::string::String>,
4094 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4096 pub transpositions: ::core::option::Option<bool>,
4097 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4100 pub use_field: ::core::option::Option<crate::Field>,
4101}
4102
4103impl IntervalsFuzzy {
4104 pub fn new(term: impl ::core::convert::Into<::std::string::String>) -> Self {
4106 Self {
4107 analyzer: ::core::option::Option::None,
4108 fuzziness: ::core::option::Option::None,
4109 prefix_length: ::core::option::Option::None,
4110 term: ::core::option::Option::Some(term.into()),
4111 transpositions: ::core::option::Option::None,
4112 use_field: ::core::option::Option::None,
4113 }
4114 }
4115}
4116
4117impl IntervalsFuzzy {
4118 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4120 self.analyzer = ::core::option::Option::Some(value.into());
4121 self
4122 }
4123 pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
4125 self.fuzziness = ::core::option::Option::Some(value.into());
4126 self
4127 }
4128 pub fn prefix_length(mut self, value: i32) -> Self {
4130 self.prefix_length = ::core::option::Option::Some(value.into());
4131 self
4132 }
4133 pub fn transpositions(mut self, value: bool) -> Self {
4135 self.transpositions = ::core::option::Option::Some(value.into());
4136 self
4137 }
4138 pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4140 self.use_field = ::core::option::Option::Some(value.into());
4141 self
4142 }
4143}
4144
4145#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4146#[non_exhaustive]
4147pub struct IntervalsMatch {
4148 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4150 pub analyzer: ::core::option::Option<::std::string::String>,
4151 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4154 pub max_gaps: ::core::option::Option<i32>,
4155 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4157 pub ordered: ::core::option::Option<bool>,
4158 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4160 pub query: ::core::option::Option<::std::string::String>,
4161 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4164 pub use_field: ::core::option::Option<crate::Field>,
4165 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4167 pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
4168}
4169
4170impl IntervalsMatch {
4171 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
4173 Self {
4174 analyzer: ::core::option::Option::None,
4175 max_gaps: ::core::option::Option::None,
4176 ordered: ::core::option::Option::None,
4177 query: ::core::option::Option::Some(query.into()),
4178 use_field: ::core::option::Option::None,
4179 filter: ::core::option::Option::None,
4180 }
4181 }
4182}
4183
4184impl IntervalsMatch {
4185 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4187 self.analyzer = ::core::option::Option::Some(value.into());
4188 self
4189 }
4190 pub fn max_gaps(mut self, value: i32) -> Self {
4192 self.max_gaps = ::core::option::Option::Some(value.into());
4193 self
4194 }
4195 pub fn ordered(mut self, value: bool) -> Self {
4197 self.ordered = ::core::option::Option::Some(value.into());
4198 self
4199 }
4200 pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4202 self.use_field = ::core::option::Option::Some(value.into());
4203 self
4204 }
4205 pub fn filter(
4207 mut self,
4208 value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
4209 ) -> Self {
4210 self.filter = ::core::option::Option::Some(value.into());
4211 self
4212 }
4213}
4214
4215#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4216#[non_exhaustive]
4217pub struct IntervalsPrefix {
4218 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4220 pub analyzer: ::core::option::Option<::std::string::String>,
4221 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4223 pub prefix: ::core::option::Option<::std::string::String>,
4224 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4227 pub use_field: ::core::option::Option<crate::Field>,
4228}
4229
4230impl IntervalsPrefix {
4231 pub fn new(prefix: impl ::core::convert::Into<::std::string::String>) -> Self {
4233 Self {
4234 analyzer: ::core::option::Option::None,
4235 prefix: ::core::option::Option::Some(prefix.into()),
4236 use_field: ::core::option::Option::None,
4237 }
4238 }
4239}
4240
4241impl IntervalsPrefix {
4242 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4244 self.analyzer = ::core::option::Option::Some(value.into());
4245 self
4246 }
4247 pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4249 self.use_field = ::core::option::Option::Some(value.into());
4250 self
4251 }
4252}
4253
4254#[derive(Clone, Debug, PartialEq)]
4256#[non_exhaustive]
4257pub enum IntervalsQueryVariant {
4258 AllOf(crate::query_dsl::IntervalsAllOf),
4260 AnyOf(crate::query_dsl::IntervalsAnyOf),
4262 Fuzzy(crate::query_dsl::IntervalsFuzzy),
4264 Match(crate::query_dsl::IntervalsMatch),
4266 Prefix(crate::query_dsl::IntervalsPrefix),
4268 Range(crate::query_dsl::IntervalsRange),
4269 Regexp(crate::query_dsl::IntervalsRegexp),
4270 Wildcard(crate::query_dsl::IntervalsWildcard),
4272 Raw(::serde_json::Value),
4274}
4275
4276impl IntervalsQueryVariant {
4277 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
4279 &self,
4280 map: &mut M__,
4281 ) -> ::core::result::Result<(), M__::Error> {
4282 match self {
4283 Self::AllOf(value) => map.serialize_entry("all_of", value),
4284 Self::AnyOf(value) => map.serialize_entry("any_of", value),
4285 Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
4286 Self::Match(value) => map.serialize_entry("match", value),
4287 Self::Prefix(value) => map.serialize_entry("prefix", value),
4288 Self::Range(value) => map.serialize_entry("range", value),
4289 Self::Regexp(value) => map.serialize_entry("regexp", value),
4290 Self::Wildcard(value) => map.serialize_entry("wildcard", value),
4291 Self::Raw(value) => match value {
4292 ::serde_json::Value::Object(entries) => {
4293 for (key, value) in entries {
4294 map.serialize_entry(key, value)?;
4295 }
4296 ::core::result::Result::Ok(())
4297 }
4298 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
4299 "a raw variant must be an object",
4300 )),
4301 },
4302 }
4303 }
4304}
4305
4306impl ::serde::Serialize for IntervalsQueryVariant {
4307 fn serialize<S__: ::serde::Serializer>(
4308 &self,
4309 serializer: S__,
4310 ) -> ::core::result::Result<S__::Ok, S__::Error> {
4311 match self {
4312 Self::AllOf(value) => {
4313 ::oxsearch_core::__private::serialize_variant(serializer, "all_of", value)
4314 }
4315 Self::AnyOf(value) => {
4316 ::oxsearch_core::__private::serialize_variant(serializer, "any_of", value)
4317 }
4318 Self::Fuzzy(value) => {
4319 ::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
4320 }
4321 Self::Match(value) => {
4322 ::oxsearch_core::__private::serialize_variant(serializer, "match", value)
4323 }
4324 Self::Prefix(value) => {
4325 ::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
4326 }
4327 Self::Range(value) => {
4328 ::oxsearch_core::__private::serialize_variant(serializer, "range", value)
4329 }
4330 Self::Regexp(value) => {
4331 ::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
4332 }
4333 Self::Wildcard(value) => {
4334 ::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
4335 }
4336 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
4337 }
4338 }
4339}
4340
4341impl<'de> ::serde::Deserialize<'de> for IntervalsQueryVariant {
4342 fn deserialize<D__: ::serde::Deserializer<'de>>(
4343 deserializer: D__,
4344 ) -> ::core::result::Result<Self, D__::Error> {
4345 ::oxsearch_core::__private::deserialize_container(deserializer)
4346 }
4347}
4348
4349impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsQueryVariant {
4350 const NAME: &'static str = "IntervalsQueryVariant";
4351 fn variant<A__: ::serde::de::MapAccess<'de>>(
4352 key: &str,
4353 map: &mut A__,
4354 ) -> ::core::result::Result<Self, A__::Error> {
4355 ::core::result::Result::Ok(match key {
4356 "all_of" => Self::AllOf(map.next_value()?),
4357 "any_of" => Self::AnyOf(map.next_value()?),
4358 "fuzzy" => Self::Fuzzy(map.next_value()?),
4359 "match" => Self::Match(map.next_value()?),
4360 "prefix" => Self::Prefix(map.next_value()?),
4361 "range" => Self::Range(map.next_value()?),
4362 "regexp" => Self::Regexp(map.next_value()?),
4363 "wildcard" => Self::Wildcard(map.next_value()?),
4364 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
4365 key,
4366 map.next_value()?,
4367 )),
4368 })
4369 }
4370}
4371
4372impl ::core::convert::From<crate::query_dsl::IntervalsAllOf> for IntervalsQueryVariant {
4373 fn from(value: crate::query_dsl::IntervalsAllOf) -> Self {
4374 Self::AllOf(value)
4375 }
4376}
4377
4378impl ::core::convert::From<crate::query_dsl::IntervalsAnyOf> for IntervalsQueryVariant {
4379 fn from(value: crate::query_dsl::IntervalsAnyOf) -> Self {
4380 Self::AnyOf(value)
4381 }
4382}
4383
4384impl ::core::convert::From<crate::query_dsl::IntervalsFuzzy> for IntervalsQueryVariant {
4385 fn from(value: crate::query_dsl::IntervalsFuzzy) -> Self {
4386 Self::Fuzzy(value)
4387 }
4388}
4389
4390impl ::core::convert::From<crate::query_dsl::IntervalsMatch> for IntervalsQueryVariant {
4391 fn from(value: crate::query_dsl::IntervalsMatch) -> Self {
4392 Self::Match(value)
4393 }
4394}
4395
4396impl ::core::convert::From<crate::query_dsl::IntervalsPrefix> for IntervalsQueryVariant {
4397 fn from(value: crate::query_dsl::IntervalsPrefix) -> Self {
4398 Self::Prefix(value)
4399 }
4400}
4401
4402impl ::core::convert::From<crate::query_dsl::IntervalsRange> for IntervalsQueryVariant {
4403 fn from(value: crate::query_dsl::IntervalsRange) -> Self {
4404 Self::Range(value)
4405 }
4406}
4407
4408impl ::core::convert::From<crate::query_dsl::IntervalsRegexp> for IntervalsQueryVariant {
4409 fn from(value: crate::query_dsl::IntervalsRegexp) -> Self {
4410 Self::Regexp(value)
4411 }
4412}
4413
4414impl ::core::convert::From<crate::query_dsl::IntervalsWildcard> for IntervalsQueryVariant {
4415 fn from(value: crate::query_dsl::IntervalsWildcard) -> Self {
4416 Self::Wildcard(value)
4417 }
4418}
4419
4420#[derive(Clone, Debug, PartialEq)]
4421#[non_exhaustive]
4422pub struct IntervalsQuery {
4423 pub boost: ::core::option::Option<f32>,
4428 pub name: ::core::option::Option<::std::string::String>,
4429 pub variant: ::core::option::Option<crate::query_dsl::IntervalsQueryVariant>,
4431}
4432
4433impl IntervalsQuery {
4434 pub fn new() -> Self {
4436 Self {
4437 boost: ::core::option::Option::None,
4438 name: ::core::option::Option::None,
4439 variant: ::core::option::Option::None,
4440 }
4441 }
4442}
4443
4444impl IntervalsQuery {
4445 pub fn boost(mut self, value: f32) -> Self {
4447 self.boost = ::core::option::Option::Some(value.into());
4448 self
4449 }
4450 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4452 self.name = ::core::option::Option::Some(value.into());
4453 self
4454 }
4455 pub fn variant(
4457 mut self,
4458 value: impl ::core::convert::Into<crate::query_dsl::IntervalsQueryVariant>,
4459 ) -> Self {
4460 self.variant = ::core::option::Option::Some(value.into());
4461 self
4462 }
4463}
4464
4465impl ::serde::Serialize for IntervalsQuery {
4466 fn serialize<S__: ::serde::Serializer>(
4467 &self,
4468 serializer: S__,
4469 ) -> ::core::result::Result<S__::Ok, S__::Error> {
4470 use ::serde::ser::SerializeMap as _;
4471 let mut map = serializer.serialize_map(::core::option::Option::None)?;
4472 if let ::core::option::Option::Some(value) = &self.boost {
4473 map.serialize_entry("boost", value)?;
4474 }
4475 if let ::core::option::Option::Some(value) = &self.name {
4476 map.serialize_entry("_name", value)?;
4477 }
4478 if let ::core::option::Option::Some(variant) = &self.variant {
4479 variant.serialize_entry(&mut map)?;
4480 }
4481 map.end()
4482 }
4483}
4484
4485impl<'de> ::serde::Deserialize<'de> for IntervalsQuery {
4486 fn deserialize<D__: ::serde::Deserializer<'de>>(
4487 deserializer: D__,
4488 ) -> ::core::result::Result<Self, D__::Error> {
4489 struct Fields;
4490 impl<'de> ::serde::de::Visitor<'de> for Fields {
4491 type Value = IntervalsQuery;
4492 fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4493 f.write_str("a IntervalsQuery object")
4494 }
4495 fn visit_map<A__: ::serde::de::MapAccess<'de>>(
4496 self,
4497 mut map: A__,
4498 ) -> ::core::result::Result<IntervalsQuery, A__::Error> {
4499 let mut boost = ::core::option::Option::None;
4500 let mut name = ::core::option::Option::None;
4501 let mut variant__ = ::core::option::Option::None;
4502 while let ::core::option::Option::Some(key) =
4503 map.next_key::<::std::string::String>()?
4504 {
4505 match key.as_str() {
4506 "boost" => boost = ::core::option::Option::Some(map.next_value()?),
4507 "_name" => name = ::core::option::Option::Some(map.next_value()?),
4508 _ => {
4509 if variant__.is_some() {
4510 return ::core::result::Result::Err(
4511 ::oxsearch_core::__private::two_variants(
4512 "IntervalsQuery",
4513 &key,
4514 ),
4515 );
4516 }
4517 variant__ = ::core::option::Option::Some(
4518 <IntervalsQueryVariant as ::oxsearch_core::__private::Container<
4519 'de,
4520 >>::variant(&key, &mut map)?,
4521 );
4522 }
4523 }
4524 }
4525 ::core::result::Result::Ok(IntervalsQuery {
4526 boost,
4527 name,
4528 variant: variant__,
4529 })
4530 }
4531 }
4532 deserializer.deserialize_map(Fields)
4533 }
4534}
4535
4536#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4537#[non_exhaustive]
4538pub struct IntervalsRange {
4539 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4541 pub analyzer: ::core::option::Option<::std::string::String>,
4542 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4544 pub gte: ::core::option::Option<::std::string::String>,
4545 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4547 pub gt: ::core::option::Option<::std::string::String>,
4548 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4550 pub lte: ::core::option::Option<::std::string::String>,
4551 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4553 pub lt: ::core::option::Option<::std::string::String>,
4554 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4557 pub use_field: ::core::option::Option<crate::Field>,
4558}
4559
4560impl IntervalsRange {
4561 pub fn new() -> Self {
4563 Self {
4564 analyzer: ::core::option::Option::None,
4565 gte: ::core::option::Option::None,
4566 gt: ::core::option::Option::None,
4567 lte: ::core::option::Option::None,
4568 lt: ::core::option::Option::None,
4569 use_field: ::core::option::Option::None,
4570 }
4571 }
4572}
4573
4574impl IntervalsRange {
4575 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4577 self.analyzer = ::core::option::Option::Some(value.into());
4578 self
4579 }
4580 pub fn gte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4582 self.gte = ::core::option::Option::Some(value.into());
4583 self
4584 }
4585 pub fn gt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4587 self.gt = ::core::option::Option::Some(value.into());
4588 self
4589 }
4590 pub fn lte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4592 self.lte = ::core::option::Option::Some(value.into());
4593 self
4594 }
4595 pub fn lt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4597 self.lt = ::core::option::Option::Some(value.into());
4598 self
4599 }
4600 pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4602 self.use_field = ::core::option::Option::Some(value.into());
4603 self
4604 }
4605}
4606
4607#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4608#[non_exhaustive]
4609pub struct IntervalsRegexp {
4610 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4612 pub analyzer: ::core::option::Option<::std::string::String>,
4613 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4615 pub pattern: ::core::option::Option<::std::string::String>,
4616 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4619 pub use_field: ::core::option::Option<crate::Field>,
4620}
4621
4622impl IntervalsRegexp {
4623 pub fn new(pattern: impl ::core::convert::Into<::std::string::String>) -> Self {
4625 Self {
4626 analyzer: ::core::option::Option::None,
4627 pattern: ::core::option::Option::Some(pattern.into()),
4628 use_field: ::core::option::Option::None,
4629 }
4630 }
4631}
4632
4633impl IntervalsRegexp {
4634 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4636 self.analyzer = ::core::option::Option::Some(value.into());
4637 self
4638 }
4639 pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4641 self.use_field = ::core::option::Option::Some(value.into());
4642 self
4643 }
4644}
4645
4646#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4647#[non_exhaustive]
4648pub struct IntervalsWildcard {
4649 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4652 pub analyzer: ::core::option::Option<::std::string::String>,
4653 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4655 pub pattern: ::core::option::Option<::std::string::String>,
4656 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4659 pub use_field: ::core::option::Option<crate::Field>,
4660}
4661
4662impl IntervalsWildcard {
4663 pub fn new(pattern: impl ::core::convert::Into<::std::string::String>) -> Self {
4665 Self {
4666 analyzer: ::core::option::Option::None,
4667 pattern: ::core::option::Option::Some(pattern.into()),
4668 use_field: ::core::option::Option::None,
4669 }
4670 }
4671}
4672
4673impl IntervalsWildcard {
4674 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4676 self.analyzer = ::core::option::Option::Some(value.into());
4677 self
4678 }
4679 pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4681 self.use_field = ::core::option::Option::Some(value.into());
4682 self
4683 }
4684}
4685
4686#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4689#[non_exhaustive]
4690pub struct KqlQuery {
4691 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4696 pub boost: ::core::option::Option<f32>,
4697 #[serde(
4698 rename = "_name",
4699 skip_serializing_if = "::core::option::Option::is_none"
4700 )]
4701 pub name: ::core::option::Option<::std::string::String>,
4702 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4704 pub case_insensitive: ::core::option::Option<bool>,
4705 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4708 pub default_field: ::core::option::Option<crate::Field>,
4709 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4711 pub query: ::core::option::Option<::std::string::String>,
4712 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4714 pub time_zone: ::core::option::Option<crate::TimeZone>,
4715}
4716
4717impl KqlQuery {
4718 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
4720 Self {
4721 boost: ::core::option::Option::None,
4722 name: ::core::option::Option::None,
4723 case_insensitive: ::core::option::Option::None,
4724 default_field: ::core::option::Option::None,
4725 query: ::core::option::Option::Some(query.into()),
4726 time_zone: ::core::option::Option::None,
4727 }
4728 }
4729}
4730
4731impl KqlQuery {
4732 pub fn boost(mut self, value: f32) -> Self {
4734 self.boost = ::core::option::Option::Some(value.into());
4735 self
4736 }
4737 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4739 self.name = ::core::option::Option::Some(value.into());
4740 self
4741 }
4742 pub fn case_insensitive(mut self, value: bool) -> Self {
4744 self.case_insensitive = ::core::option::Option::Some(value.into());
4745 self
4746 }
4747 pub fn default_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4749 self.default_field = ::core::option::Option::Some(value.into());
4750 self
4751 }
4752 pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
4754 self.time_zone = ::core::option::Option::Some(value.into());
4755 self
4756 }
4757}
4758
4759#[derive(Clone, Debug, PartialEq)]
4761#[non_exhaustive]
4762pub enum Like {
4763 Text(::std::string::String),
4765 Document(crate::query_dsl::LikeDocument),
4767}
4768
4769impl ::serde::Serialize for Like {
4770 fn serialize<S__: ::serde::Serializer>(
4771 &self,
4772 serializer: S__,
4773 ) -> ::core::result::Result<S__::Ok, S__::Error> {
4774 match self {
4775 Self::Text(value) => ::serde::Serialize::serialize(value, serializer),
4776 Self::Document(value) => ::serde::Serialize::serialize(value, serializer),
4777 }
4778 }
4779}
4780
4781impl<'de> ::serde::Deserialize<'de> for Like {
4782 fn deserialize<D__: ::serde::Deserializer<'de>>(
4783 deserializer: D__,
4784 ) -> ::core::result::Result<Self, D__::Error> {
4785 struct Shape;
4786 impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
4787 type Value = Like;
4788 const EXPECTING: &'static str = "Like: object or string";
4789 fn visit<V__: ::serde::Deserializer<'de>>(
4790 self,
4791 kind: ::oxsearch_core::__private::Kind,
4792 value: V__,
4793 ) -> ::core::result::Result<Self::Value, V__::Error> {
4794 match kind {
4795 ::oxsearch_core::__private::Kind::String => {
4796 <::std::string::String as ::serde::Deserialize>::deserialize(value)
4797 .map(Like::Text)
4798 }
4799 ::oxsearch_core::__private::Kind::Object => {
4800 <crate::query_dsl::LikeDocument as ::serde::Deserialize>::deserialize(value)
4801 .map(Like::Document)
4802 }
4803 _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
4804 format_args!("Like can't be {kind:?}"),
4805 )),
4806 }
4807 }
4808 }
4809 ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
4810 }
4811}
4812
4813impl ::core::convert::From<::std::string::String> for Like {
4814 fn from(value: ::std::string::String) -> Self {
4815 Self::Text(value)
4816 }
4817}
4818
4819impl ::core::convert::From<crate::query_dsl::LikeDocument> for Like {
4820 fn from(value: crate::query_dsl::LikeDocument) -> Self {
4821 Self::Document(value)
4822 }
4823}
4824
4825impl ::core::convert::From<&str> for Like {
4826 fn from(value: &str) -> Self {
4827 Self::Text(::std::borrow::ToOwned::to_owned(value))
4828 }
4829}
4830
4831#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4832#[non_exhaustive]
4833pub struct LikeDocument {
4834 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4836 pub doc: ::core::option::Option<::serde_json::Value>,
4837 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4838 pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
4839 #[serde(
4841 rename = "_id",
4842 skip_serializing_if = "::core::option::Option::is_none"
4843 )]
4844 pub id: ::core::option::Option<crate::Id>,
4845 #[serde(
4847 rename = "_index",
4848 skip_serializing_if = "::core::option::Option::is_none"
4849 )]
4850 pub index: ::core::option::Option<crate::IndexName>,
4851 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4853 pub per_field_analyzer:
4854 ::core::option::Option<::indexmap::IndexMap<crate::Field, ::std::string::String>>,
4855 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4856 pub routing: ::core::option::Option<crate::Routing>,
4857 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4858 pub version: ::core::option::Option<crate::VersionNumber>,
4859 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4860 pub version_type: ::core::option::Option<crate::VersionType>,
4861}
4862
4863impl LikeDocument {
4864 pub fn new() -> Self {
4866 Self {
4867 doc: ::core::option::Option::None,
4868 fields: ::core::option::Option::None,
4869 id: ::core::option::Option::None,
4870 index: ::core::option::Option::None,
4871 per_field_analyzer: ::core::option::Option::None,
4872 routing: ::core::option::Option::None,
4873 version: ::core::option::Option::None,
4874 version_type: ::core::option::Option::None,
4875 }
4876 }
4877}
4878
4879impl LikeDocument {
4880 pub fn doc(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
4882 self.doc = ::core::option::Option::Some(value.into());
4883 self
4884 }
4885 pub fn fields(
4887 mut self,
4888 value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
4889 ) -> Self {
4890 self.fields = ::core::option::Option::Some(value.into());
4891 self
4892 }
4893 pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
4895 self.id = ::core::option::Option::Some(value.into());
4896 self
4897 }
4898 pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
4900 self.index = ::core::option::Option::Some(value.into());
4901 self
4902 }
4903 pub fn per_field_analyzer(
4905 mut self,
4906 value: impl ::core::convert::Into<::indexmap::IndexMap<crate::Field, ::std::string::String>>,
4907 ) -> Self {
4908 self.per_field_analyzer = ::core::option::Option::Some(value.into());
4909 self
4910 }
4911 pub fn routing(mut self, value: impl ::core::convert::Into<crate::Routing>) -> Self {
4913 self.routing = ::core::option::Option::Some(value.into());
4914 self
4915 }
4916 pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
4918 self.version = ::core::option::Option::Some(value.into());
4919 self
4920 }
4921 pub fn version_type(mut self, value: impl ::core::convert::Into<crate::VersionType>) -> Self {
4923 self.version_type = ::core::option::Option::Some(value.into());
4924 self
4925 }
4926}
4927
4928#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4929#[non_exhaustive]
4930pub struct LongNumberRangeQuery {
4931 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4936 pub boost: ::core::option::Option<f32>,
4937 #[serde(
4938 rename = "_name",
4939 skip_serializing_if = "::core::option::Option::is_none"
4940 )]
4941 pub name: ::core::option::Option<::std::string::String>,
4942 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4944 pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
4945 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4947 pub gt: ::core::option::Option<i64>,
4948 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4950 pub gte: ::core::option::Option<i64>,
4951 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4953 pub lt: ::core::option::Option<i64>,
4954 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4956 pub lte: ::core::option::Option<i64>,
4957}
4958
4959impl LongNumberRangeQuery {
4960 pub fn new() -> Self {
4962 Self {
4963 boost: ::core::option::Option::None,
4964 name: ::core::option::Option::None,
4965 relation: ::core::option::Option::None,
4966 gt: ::core::option::Option::None,
4967 gte: ::core::option::Option::None,
4968 lt: ::core::option::Option::None,
4969 lte: ::core::option::Option::None,
4970 }
4971 }
4972}
4973
4974impl LongNumberRangeQuery {
4975 pub fn boost(mut self, value: f32) -> Self {
4977 self.boost = ::core::option::Option::Some(value.into());
4978 self
4979 }
4980 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4982 self.name = ::core::option::Option::Some(value.into());
4983 self
4984 }
4985 pub fn relation(
4987 mut self,
4988 value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
4989 ) -> Self {
4990 self.relation = ::core::option::Option::Some(value.into());
4991 self
4992 }
4993 pub fn gt(mut self, value: i64) -> Self {
4995 self.gt = ::core::option::Option::Some(value.into());
4996 self
4997 }
4998 pub fn gte(mut self, value: i64) -> Self {
5000 self.gte = ::core::option::Option::Some(value.into());
5001 self
5002 }
5003 pub fn lt(mut self, value: i64) -> Self {
5005 self.lt = ::core::option::Option::Some(value.into());
5006 self
5007 }
5008 pub fn lte(mut self, value: i64) -> Self {
5010 self.lte = ::core::option::Option::Some(value.into());
5011 self
5012 }
5013}
5014
5015#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5016#[non_exhaustive]
5017pub struct MatchAllQuery {
5018 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5023 pub boost: ::core::option::Option<f32>,
5024 #[serde(
5025 rename = "_name",
5026 skip_serializing_if = "::core::option::Option::is_none"
5027 )]
5028 pub name: ::core::option::Option<::std::string::String>,
5029}
5030
5031impl MatchAllQuery {
5032 pub fn new() -> Self {
5034 Self {
5035 boost: ::core::option::Option::None,
5036 name: ::core::option::Option::None,
5037 }
5038 }
5039}
5040
5041impl MatchAllQuery {
5042 pub fn boost(mut self, value: f32) -> Self {
5044 self.boost = ::core::option::Option::Some(value.into());
5045 self
5046 }
5047 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5049 self.name = ::core::option::Option::Some(value.into());
5050 self
5051 }
5052}
5053
5054#[derive(Clone, Debug, PartialEq)]
5055#[non_exhaustive]
5056pub struct MatchBoolPrefixQuery {
5057 pub boost: ::core::option::Option<f32>,
5062 pub name: ::core::option::Option<::std::string::String>,
5063 pub analyzer: ::core::option::Option<::std::string::String>,
5065 pub fuzziness: ::core::option::Option<crate::Fuzziness>,
5068 pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5071 pub fuzzy_transpositions: ::core::option::Option<bool>,
5074 pub max_expansions: ::core::option::Option<i32>,
5077 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5080 pub operator: ::core::option::Option<crate::query_dsl::Operator>,
5083 pub prefix_length: ::core::option::Option<i32>,
5086 pub query: ::core::option::Option<::std::string::String>,
5089}
5090
5091impl MatchBoolPrefixQuery {
5092 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
5094 Self {
5095 boost: ::core::option::Option::None,
5096 name: ::core::option::Option::None,
5097 analyzer: ::core::option::Option::None,
5098 fuzziness: ::core::option::Option::None,
5099 fuzzy_rewrite: ::core::option::Option::None,
5100 fuzzy_transpositions: ::core::option::Option::None,
5101 max_expansions: ::core::option::Option::None,
5102 minimum_should_match: ::core::option::Option::None,
5103 operator: ::core::option::Option::None,
5104 prefix_length: ::core::option::Option::None,
5105 query: ::core::option::Option::Some(query.into()),
5106 }
5107 }
5108}
5109
5110impl MatchBoolPrefixQuery {
5111 pub fn boost(mut self, value: f32) -> Self {
5113 self.boost = ::core::option::Option::Some(value.into());
5114 self
5115 }
5116 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5118 self.name = ::core::option::Option::Some(value.into());
5119 self
5120 }
5121 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5123 self.analyzer = ::core::option::Option::Some(value.into());
5124 self
5125 }
5126 pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
5128 self.fuzziness = ::core::option::Option::Some(value.into());
5129 self
5130 }
5131 pub fn fuzzy_rewrite(
5133 mut self,
5134 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
5135 ) -> Self {
5136 self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
5137 self
5138 }
5139 pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
5141 self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
5142 self
5143 }
5144 pub fn max_expansions(mut self, value: i32) -> Self {
5146 self.max_expansions = ::core::option::Option::Some(value.into());
5147 self
5148 }
5149 pub fn minimum_should_match(
5151 mut self,
5152 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
5153 ) -> Self {
5154 self.minimum_should_match = ::core::option::Option::Some(value.into());
5155 self
5156 }
5157 pub fn operator(
5159 mut self,
5160 value: impl ::core::convert::Into<crate::query_dsl::Operator>,
5161 ) -> Self {
5162 self.operator = ::core::option::Option::Some(value.into());
5163 self
5164 }
5165 pub fn prefix_length(mut self, value: i32) -> Self {
5167 self.prefix_length = ::core::option::Option::Some(value.into());
5168 self
5169 }
5170}
5171
5172#[derive(::serde::Serialize, ::serde::Deserialize)]
5173#[serde(remote = "MatchBoolPrefixQuery")]
5174struct MatchBoolPrefixQueryDef {
5175 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5180 boost: ::core::option::Option<f32>,
5181 #[serde(
5182 rename = "_name",
5183 skip_serializing_if = "::core::option::Option::is_none"
5184 )]
5185 name: ::core::option::Option<::std::string::String>,
5186 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5188 analyzer: ::core::option::Option<::std::string::String>,
5189 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5192 fuzziness: ::core::option::Option<crate::Fuzziness>,
5193 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5196 fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5197 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5200 fuzzy_transpositions: ::core::option::Option<bool>,
5201 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5204 max_expansions: ::core::option::Option<i32>,
5205 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5208 minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5209 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5212 operator: ::core::option::Option<crate::query_dsl::Operator>,
5213 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5216 prefix_length: ::core::option::Option<i32>,
5217 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5220 query: ::core::option::Option<::std::string::String>,
5221}
5222
5223impl ::serde::Serialize for MatchBoolPrefixQuery {
5224 fn serialize<S__: ::serde::Serializer>(
5225 &self,
5226 serializer: S__,
5227 ) -> ::core::result::Result<S__::Ok, S__::Error> {
5228 if let (::core::option::Option::Some(short), true) = (
5229 &self.query,
5230 self.boost.is_none()
5231 && self.name.is_none()
5232 && self.analyzer.is_none()
5233 && self.fuzziness.is_none()
5234 && self.fuzzy_rewrite.is_none()
5235 && self.fuzzy_transpositions.is_none()
5236 && self.max_expansions.is_none()
5237 && self.minimum_should_match.is_none()
5238 && self.operator.is_none()
5239 && self.prefix_length.is_none(),
5240 ) {
5241 return ::serde::Serialize::serialize(short, serializer);
5242 }
5243 MatchBoolPrefixQueryDef::serialize(self, serializer)
5244 }
5245}
5246
5247impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchBoolPrefixQuery {
5248 type Short = ::std::string::String;
5249 fn from_short(short: ::std::string::String) -> Self {
5250 Self {
5251 boost: ::core::option::Option::None,
5252 name: ::core::option::Option::None,
5253 analyzer: ::core::option::Option::None,
5254 fuzziness: ::core::option::Option::None,
5255 fuzzy_rewrite: ::core::option::Option::None,
5256 fuzzy_transpositions: ::core::option::Option::None,
5257 max_expansions: ::core::option::Option::None,
5258 minimum_should_match: ::core::option::Option::None,
5259 operator: ::core::option::Option::None,
5260 prefix_length: ::core::option::Option::None,
5261 query: ::core::option::Option::Some(short),
5262 }
5263 }
5264 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5265 deserializer: D__,
5266 ) -> ::core::result::Result<Self, D__::Error> {
5267 MatchBoolPrefixQueryDef::deserialize(deserializer)
5268 }
5269}
5270
5271impl<'de> ::serde::Deserialize<'de> for MatchBoolPrefixQuery {
5272 fn deserialize<D__: ::serde::Deserializer<'de>>(
5273 deserializer: D__,
5274 ) -> ::core::result::Result<Self, D__::Error> {
5275 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5276 }
5277}
5278
5279#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5280#[non_exhaustive]
5281pub struct MatchNoneQuery {
5282 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5287 pub boost: ::core::option::Option<f32>,
5288 #[serde(
5289 rename = "_name",
5290 skip_serializing_if = "::core::option::Option::is_none"
5291 )]
5292 pub name: ::core::option::Option<::std::string::String>,
5293}
5294
5295impl MatchNoneQuery {
5296 pub fn new() -> Self {
5298 Self {
5299 boost: ::core::option::Option::None,
5300 name: ::core::option::Option::None,
5301 }
5302 }
5303}
5304
5305impl MatchNoneQuery {
5306 pub fn boost(mut self, value: f32) -> Self {
5308 self.boost = ::core::option::Option::Some(value.into());
5309 self
5310 }
5311 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5313 self.name = ::core::option::Option::Some(value.into());
5314 self
5315 }
5316}
5317
5318#[derive(Clone, Debug, PartialEq)]
5319#[non_exhaustive]
5320pub struct MatchPhrasePrefixQuery {
5321 pub boost: ::core::option::Option<f32>,
5326 pub name: ::core::option::Option<::std::string::String>,
5327 pub analyzer: ::core::option::Option<::std::string::String>,
5329 pub max_expansions: ::core::option::Option<i32>,
5331 pub query: ::core::option::Option<::std::string::String>,
5333 pub slop: ::core::option::Option<i32>,
5335 pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5337}
5338
5339impl MatchPhrasePrefixQuery {
5340 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
5342 Self {
5343 boost: ::core::option::Option::None,
5344 name: ::core::option::Option::None,
5345 analyzer: ::core::option::Option::None,
5346 max_expansions: ::core::option::Option::None,
5347 query: ::core::option::Option::Some(query.into()),
5348 slop: ::core::option::Option::None,
5349 zero_terms_query: ::core::option::Option::None,
5350 }
5351 }
5352}
5353
5354impl MatchPhrasePrefixQuery {
5355 pub fn boost(mut self, value: f32) -> Self {
5357 self.boost = ::core::option::Option::Some(value.into());
5358 self
5359 }
5360 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5362 self.name = ::core::option::Option::Some(value.into());
5363 self
5364 }
5365 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5367 self.analyzer = ::core::option::Option::Some(value.into());
5368 self
5369 }
5370 pub fn max_expansions(mut self, value: i32) -> Self {
5372 self.max_expansions = ::core::option::Option::Some(value.into());
5373 self
5374 }
5375 pub fn slop(mut self, value: i32) -> Self {
5377 self.slop = ::core::option::Option::Some(value.into());
5378 self
5379 }
5380 pub fn zero_terms_query(
5382 mut self,
5383 value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
5384 ) -> Self {
5385 self.zero_terms_query = ::core::option::Option::Some(value.into());
5386 self
5387 }
5388}
5389
5390#[derive(::serde::Serialize, ::serde::Deserialize)]
5391#[serde(remote = "MatchPhrasePrefixQuery")]
5392struct MatchPhrasePrefixQueryDef {
5393 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5398 boost: ::core::option::Option<f32>,
5399 #[serde(
5400 rename = "_name",
5401 skip_serializing_if = "::core::option::Option::is_none"
5402 )]
5403 name: ::core::option::Option<::std::string::String>,
5404 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5406 analyzer: ::core::option::Option<::std::string::String>,
5407 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5409 max_expansions: ::core::option::Option<i32>,
5410 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5412 query: ::core::option::Option<::std::string::String>,
5413 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5415 slop: ::core::option::Option<i32>,
5416 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5418 zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5419}
5420
5421impl ::serde::Serialize for MatchPhrasePrefixQuery {
5422 fn serialize<S__: ::serde::Serializer>(
5423 &self,
5424 serializer: S__,
5425 ) -> ::core::result::Result<S__::Ok, S__::Error> {
5426 if let (::core::option::Option::Some(short), true) = (
5427 &self.query,
5428 self.boost.is_none()
5429 && self.name.is_none()
5430 && self.analyzer.is_none()
5431 && self.max_expansions.is_none()
5432 && self.slop.is_none()
5433 && self.zero_terms_query.is_none(),
5434 ) {
5435 return ::serde::Serialize::serialize(short, serializer);
5436 }
5437 MatchPhrasePrefixQueryDef::serialize(self, serializer)
5438 }
5439}
5440
5441impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchPhrasePrefixQuery {
5442 type Short = ::std::string::String;
5443 fn from_short(short: ::std::string::String) -> Self {
5444 Self {
5445 boost: ::core::option::Option::None,
5446 name: ::core::option::Option::None,
5447 analyzer: ::core::option::Option::None,
5448 max_expansions: ::core::option::Option::None,
5449 query: ::core::option::Option::Some(short),
5450 slop: ::core::option::Option::None,
5451 zero_terms_query: ::core::option::Option::None,
5452 }
5453 }
5454 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5455 deserializer: D__,
5456 ) -> ::core::result::Result<Self, D__::Error> {
5457 MatchPhrasePrefixQueryDef::deserialize(deserializer)
5458 }
5459}
5460
5461impl<'de> ::serde::Deserialize<'de> for MatchPhrasePrefixQuery {
5462 fn deserialize<D__: ::serde::Deserializer<'de>>(
5463 deserializer: D__,
5464 ) -> ::core::result::Result<Self, D__::Error> {
5465 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5466 }
5467}
5468
5469#[derive(Clone, Debug, PartialEq)]
5470#[non_exhaustive]
5471pub struct MatchPhraseQuery {
5472 pub boost: ::core::option::Option<f32>,
5477 pub name: ::core::option::Option<::std::string::String>,
5478 pub analyzer: ::core::option::Option<::std::string::String>,
5480 pub query: ::core::option::Option<::std::string::String>,
5482 pub slop: ::core::option::Option<i32>,
5484 pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5486}
5487
5488impl MatchPhraseQuery {
5489 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
5491 Self {
5492 boost: ::core::option::Option::None,
5493 name: ::core::option::Option::None,
5494 analyzer: ::core::option::Option::None,
5495 query: ::core::option::Option::Some(query.into()),
5496 slop: ::core::option::Option::None,
5497 zero_terms_query: ::core::option::Option::None,
5498 }
5499 }
5500}
5501
5502impl MatchPhraseQuery {
5503 pub fn boost(mut self, value: f32) -> Self {
5505 self.boost = ::core::option::Option::Some(value.into());
5506 self
5507 }
5508 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5510 self.name = ::core::option::Option::Some(value.into());
5511 self
5512 }
5513 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5515 self.analyzer = ::core::option::Option::Some(value.into());
5516 self
5517 }
5518 pub fn slop(mut self, value: i32) -> Self {
5520 self.slop = ::core::option::Option::Some(value.into());
5521 self
5522 }
5523 pub fn zero_terms_query(
5525 mut self,
5526 value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
5527 ) -> Self {
5528 self.zero_terms_query = ::core::option::Option::Some(value.into());
5529 self
5530 }
5531}
5532
5533#[derive(::serde::Serialize, ::serde::Deserialize)]
5534#[serde(remote = "MatchPhraseQuery")]
5535struct MatchPhraseQueryDef {
5536 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5541 boost: ::core::option::Option<f32>,
5542 #[serde(
5543 rename = "_name",
5544 skip_serializing_if = "::core::option::Option::is_none"
5545 )]
5546 name: ::core::option::Option<::std::string::String>,
5547 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5549 analyzer: ::core::option::Option<::std::string::String>,
5550 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5552 query: ::core::option::Option<::std::string::String>,
5553 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5555 slop: ::core::option::Option<i32>,
5556 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5558 zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5559}
5560
5561impl ::serde::Serialize for MatchPhraseQuery {
5562 fn serialize<S__: ::serde::Serializer>(
5563 &self,
5564 serializer: S__,
5565 ) -> ::core::result::Result<S__::Ok, S__::Error> {
5566 if let (::core::option::Option::Some(short), true) = (
5567 &self.query,
5568 self.boost.is_none()
5569 && self.name.is_none()
5570 && self.analyzer.is_none()
5571 && self.slop.is_none()
5572 && self.zero_terms_query.is_none(),
5573 ) {
5574 return ::serde::Serialize::serialize(short, serializer);
5575 }
5576 MatchPhraseQueryDef::serialize(self, serializer)
5577 }
5578}
5579
5580impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchPhraseQuery {
5581 type Short = ::std::string::String;
5582 fn from_short(short: ::std::string::String) -> Self {
5583 Self {
5584 boost: ::core::option::Option::None,
5585 name: ::core::option::Option::None,
5586 analyzer: ::core::option::Option::None,
5587 query: ::core::option::Option::Some(short),
5588 slop: ::core::option::Option::None,
5589 zero_terms_query: ::core::option::Option::None,
5590 }
5591 }
5592 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5593 deserializer: D__,
5594 ) -> ::core::result::Result<Self, D__::Error> {
5595 MatchPhraseQueryDef::deserialize(deserializer)
5596 }
5597}
5598
5599impl<'de> ::serde::Deserialize<'de> for MatchPhraseQuery {
5600 fn deserialize<D__: ::serde::Deserializer<'de>>(
5601 deserializer: D__,
5602 ) -> ::core::result::Result<Self, D__::Error> {
5603 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5604 }
5605}
5606
5607#[derive(Clone, Debug, PartialEq)]
5608#[non_exhaustive]
5609pub enum MatchQueryQuery {
5610 String(::std::string::String),
5612 Float(f32),
5614 Bool(bool),
5616}
5617
5618impl ::serde::Serialize for MatchQueryQuery {
5619 fn serialize<S__: ::serde::Serializer>(
5620 &self,
5621 serializer: S__,
5622 ) -> ::core::result::Result<S__::Ok, S__::Error> {
5623 match self {
5624 Self::String(value) => ::serde::Serialize::serialize(value, serializer),
5625 Self::Float(value) => ::serde::Serialize::serialize(value, serializer),
5626 Self::Bool(value) => ::serde::Serialize::serialize(value, serializer),
5627 }
5628 }
5629}
5630
5631impl<'de> ::serde::Deserialize<'de> for MatchQueryQuery {
5632 fn deserialize<D__: ::serde::Deserializer<'de>>(
5633 deserializer: D__,
5634 ) -> ::core::result::Result<Self, D__::Error> {
5635 struct Shape;
5636 impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
5637 type Value = MatchQueryQuery;
5638 const EXPECTING: &'static str = "MatchQueryQuery: boolean or number or string";
5639 fn visit<V__: ::serde::Deserializer<'de>>(
5640 self,
5641 kind: ::oxsearch_core::__private::Kind,
5642 value: V__,
5643 ) -> ::core::result::Result<Self::Value, V__::Error> {
5644 match kind {
5645 ::oxsearch_core::__private::Kind::Bool => {
5646 <bool as ::serde::Deserialize>::deserialize(value)
5647 .map(MatchQueryQuery::Bool)
5648 }
5649 ::oxsearch_core::__private::Kind::Number => {
5650 <f32 as ::serde::Deserialize>::deserialize(value)
5651 .map(MatchQueryQuery::Float)
5652 }
5653 ::oxsearch_core::__private::Kind::String => {
5654 <::std::string::String as ::serde::Deserialize>::deserialize(value)
5655 .map(MatchQueryQuery::String)
5656 }
5657 _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
5658 format_args!("MatchQueryQuery can't be {kind:?}"),
5659 )),
5660 }
5661 }
5662 }
5663 ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
5664 }
5665}
5666
5667impl ::core::convert::From<::std::string::String> for MatchQueryQuery {
5668 fn from(value: ::std::string::String) -> Self {
5669 Self::String(value)
5670 }
5671}
5672
5673impl ::core::convert::From<f32> for MatchQueryQuery {
5674 fn from(value: f32) -> Self {
5675 Self::Float(value)
5676 }
5677}
5678
5679impl ::core::convert::From<bool> for MatchQueryQuery {
5680 fn from(value: bool) -> Self {
5681 Self::Bool(value)
5682 }
5683}
5684
5685impl ::core::convert::From<&str> for MatchQueryQuery {
5686 fn from(value: &str) -> Self {
5687 Self::String(::std::borrow::ToOwned::to_owned(value))
5688 }
5689}
5690
5691#[derive(Clone, Debug, PartialEq)]
5692#[non_exhaustive]
5693pub struct MatchQuery {
5694 pub boost: ::core::option::Option<f32>,
5699 pub name: ::core::option::Option<::std::string::String>,
5700 pub analyzer: ::core::option::Option<::std::string::String>,
5702 pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
5704 pub cutoff_frequency: ::core::option::Option<f64>,
5705 pub fuzziness: ::core::option::Option<crate::Fuzziness>,
5707 pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5709 pub fuzzy_transpositions: ::core::option::Option<bool>,
5711 pub lenient: ::core::option::Option<bool>,
5713 pub max_expansions: ::core::option::Option<i32>,
5715 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5717 pub operator: ::core::option::Option<crate::query_dsl::Operator>,
5719 pub prefix_length: ::core::option::Option<i32>,
5721 pub query: ::core::option::Option<crate::query_dsl::MatchQueryQuery>,
5723 pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5725}
5726
5727impl MatchQuery {
5728 pub fn new(query: impl ::core::convert::Into<crate::query_dsl::MatchQueryQuery>) -> Self {
5730 Self {
5731 boost: ::core::option::Option::None,
5732 name: ::core::option::Option::None,
5733 analyzer: ::core::option::Option::None,
5734 auto_generate_synonyms_phrase_query: ::core::option::Option::None,
5735 cutoff_frequency: ::core::option::Option::None,
5736 fuzziness: ::core::option::Option::None,
5737 fuzzy_rewrite: ::core::option::Option::None,
5738 fuzzy_transpositions: ::core::option::Option::None,
5739 lenient: ::core::option::Option::None,
5740 max_expansions: ::core::option::Option::None,
5741 minimum_should_match: ::core::option::Option::None,
5742 operator: ::core::option::Option::None,
5743 prefix_length: ::core::option::Option::None,
5744 query: ::core::option::Option::Some(query.into()),
5745 zero_terms_query: ::core::option::Option::None,
5746 }
5747 }
5748}
5749
5750impl MatchQuery {
5751 pub fn boost(mut self, value: f32) -> Self {
5753 self.boost = ::core::option::Option::Some(value.into());
5754 self
5755 }
5756 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5758 self.name = ::core::option::Option::Some(value.into());
5759 self
5760 }
5761 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5763 self.analyzer = ::core::option::Option::Some(value.into());
5764 self
5765 }
5766 pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
5768 self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
5769 self
5770 }
5771 pub fn cutoff_frequency(mut self, value: f64) -> Self {
5773 self.cutoff_frequency = ::core::option::Option::Some(value.into());
5774 self
5775 }
5776 pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
5778 self.fuzziness = ::core::option::Option::Some(value.into());
5779 self
5780 }
5781 pub fn fuzzy_rewrite(
5783 mut self,
5784 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
5785 ) -> Self {
5786 self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
5787 self
5788 }
5789 pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
5791 self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
5792 self
5793 }
5794 pub fn lenient(mut self, value: bool) -> Self {
5796 self.lenient = ::core::option::Option::Some(value.into());
5797 self
5798 }
5799 pub fn max_expansions(mut self, value: i32) -> Self {
5801 self.max_expansions = ::core::option::Option::Some(value.into());
5802 self
5803 }
5804 pub fn minimum_should_match(
5806 mut self,
5807 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
5808 ) -> Self {
5809 self.minimum_should_match = ::core::option::Option::Some(value.into());
5810 self
5811 }
5812 pub fn operator(
5814 mut self,
5815 value: impl ::core::convert::Into<crate::query_dsl::Operator>,
5816 ) -> Self {
5817 self.operator = ::core::option::Option::Some(value.into());
5818 self
5819 }
5820 pub fn prefix_length(mut self, value: i32) -> Self {
5822 self.prefix_length = ::core::option::Option::Some(value.into());
5823 self
5824 }
5825 pub fn zero_terms_query(
5827 mut self,
5828 value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
5829 ) -> Self {
5830 self.zero_terms_query = ::core::option::Option::Some(value.into());
5831 self
5832 }
5833}
5834
5835#[derive(::serde::Serialize, ::serde::Deserialize)]
5836#[serde(remote = "MatchQuery")]
5837struct MatchQueryDef {
5838 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5843 boost: ::core::option::Option<f32>,
5844 #[serde(
5845 rename = "_name",
5846 skip_serializing_if = "::core::option::Option::is_none"
5847 )]
5848 name: ::core::option::Option<::std::string::String>,
5849 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5851 analyzer: ::core::option::Option<::std::string::String>,
5852 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5854 auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
5855 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5856 cutoff_frequency: ::core::option::Option<f64>,
5857 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5859 fuzziness: ::core::option::Option<crate::Fuzziness>,
5860 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5862 fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5863 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5865 fuzzy_transpositions: ::core::option::Option<bool>,
5866 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5868 lenient: ::core::option::Option<bool>,
5869 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5871 max_expansions: ::core::option::Option<i32>,
5872 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5874 minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5875 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5877 operator: ::core::option::Option<crate::query_dsl::Operator>,
5878 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5880 prefix_length: ::core::option::Option<i32>,
5881 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5883 query: ::core::option::Option<crate::query_dsl::MatchQueryQuery>,
5884 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5886 zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5887}
5888
5889impl ::serde::Serialize for MatchQuery {
5890 fn serialize<S__: ::serde::Serializer>(
5891 &self,
5892 serializer: S__,
5893 ) -> ::core::result::Result<S__::Ok, S__::Error> {
5894 if let (::core::option::Option::Some(short), true) = (
5895 &self.query,
5896 self.boost.is_none()
5897 && self.name.is_none()
5898 && self.analyzer.is_none()
5899 && self.auto_generate_synonyms_phrase_query.is_none()
5900 && self.cutoff_frequency.is_none()
5901 && self.fuzziness.is_none()
5902 && self.fuzzy_rewrite.is_none()
5903 && self.fuzzy_transpositions.is_none()
5904 && self.lenient.is_none()
5905 && self.max_expansions.is_none()
5906 && self.minimum_should_match.is_none()
5907 && self.operator.is_none()
5908 && self.prefix_length.is_none()
5909 && self.zero_terms_query.is_none(),
5910 ) {
5911 return ::serde::Serialize::serialize(short, serializer);
5912 }
5913 MatchQueryDef::serialize(self, serializer)
5914 }
5915}
5916
5917impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchQuery {
5918 type Short = crate::query_dsl::MatchQueryQuery;
5919 fn from_short(short: crate::query_dsl::MatchQueryQuery) -> Self {
5920 Self {
5921 boost: ::core::option::Option::None,
5922 name: ::core::option::Option::None,
5923 analyzer: ::core::option::Option::None,
5924 auto_generate_synonyms_phrase_query: ::core::option::Option::None,
5925 cutoff_frequency: ::core::option::Option::None,
5926 fuzziness: ::core::option::Option::None,
5927 fuzzy_rewrite: ::core::option::Option::None,
5928 fuzzy_transpositions: ::core::option::Option::None,
5929 lenient: ::core::option::Option::None,
5930 max_expansions: ::core::option::Option::None,
5931 minimum_should_match: ::core::option::Option::None,
5932 operator: ::core::option::Option::None,
5933 prefix_length: ::core::option::Option::None,
5934 query: ::core::option::Option::Some(short),
5935 zero_terms_query: ::core::option::Option::None,
5936 }
5937 }
5938 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5939 deserializer: D__,
5940 ) -> ::core::result::Result<Self, D__::Error> {
5941 MatchQueryDef::deserialize(deserializer)
5942 }
5943}
5944
5945impl<'de> ::serde::Deserialize<'de> for MatchQuery {
5946 fn deserialize<D__: ::serde::Deserializer<'de>>(
5947 deserializer: D__,
5948 ) -> ::core::result::Result<Self, D__::Error> {
5949 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5950 }
5951}
5952
5953#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5954#[non_exhaustive]
5955pub struct MoreLikeThisQuery {
5956 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5961 pub boost: ::core::option::Option<f32>,
5962 #[serde(
5963 rename = "_name",
5964 skip_serializing_if = "::core::option::Option::is_none"
5965 )]
5966 pub name: ::core::option::Option<::std::string::String>,
5967 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5970 pub analyzer: ::core::option::Option<::std::string::String>,
5971 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5975 pub boost_terms: ::core::option::Option<f64>,
5976 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5978 pub fail_on_unsupported_field: ::core::option::Option<bool>,
5979 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5982 pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
5983 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5985 pub include: ::core::option::Option<bool>,
5986 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5988 pub like: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
5989 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5991 pub max_doc_freq: ::core::option::Option<i32>,
5992 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5994 pub max_query_terms: ::core::option::Option<i32>,
5995 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5998 pub max_word_length: ::core::option::Option<i32>,
5999 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6001 pub min_doc_freq: ::core::option::Option<i32>,
6002 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6004 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
6005 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6007 pub min_term_freq: ::core::option::Option<i32>,
6008 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6010 pub min_word_length: ::core::option::Option<i32>,
6011 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6012 pub routing: ::core::option::Option<::std::string::String>,
6013 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6016 pub stop_words: ::core::option::Option<crate::analysis::StopWords>,
6017 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6019 pub unlike: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
6020 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6021 pub version: ::core::option::Option<crate::VersionNumber>,
6022 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6023 pub version_type: ::core::option::Option<crate::VersionType>,
6024}
6025
6026impl MoreLikeThisQuery {
6027 pub fn new(
6029 like: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
6030 ) -> Self {
6031 Self {
6032 boost: ::core::option::Option::None,
6033 name: ::core::option::Option::None,
6034 analyzer: ::core::option::Option::None,
6035 boost_terms: ::core::option::Option::None,
6036 fail_on_unsupported_field: ::core::option::Option::None,
6037 fields: ::core::option::Option::None,
6038 include: ::core::option::Option::None,
6039 like: ::core::option::Option::Some(like.into()),
6040 max_doc_freq: ::core::option::Option::None,
6041 max_query_terms: ::core::option::Option::None,
6042 max_word_length: ::core::option::Option::None,
6043 min_doc_freq: ::core::option::Option::None,
6044 minimum_should_match: ::core::option::Option::None,
6045 min_term_freq: ::core::option::Option::None,
6046 min_word_length: ::core::option::Option::None,
6047 routing: ::core::option::Option::None,
6048 stop_words: ::core::option::Option::None,
6049 unlike: ::core::option::Option::None,
6050 version: ::core::option::Option::None,
6051 version_type: ::core::option::Option::None,
6052 }
6053 }
6054}
6055
6056impl MoreLikeThisQuery {
6057 pub fn boost(mut self, value: f32) -> Self {
6059 self.boost = ::core::option::Option::Some(value.into());
6060 self
6061 }
6062 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6064 self.name = ::core::option::Option::Some(value.into());
6065 self
6066 }
6067 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6069 self.analyzer = ::core::option::Option::Some(value.into());
6070 self
6071 }
6072 pub fn boost_terms(mut self, value: f64) -> Self {
6074 self.boost_terms = ::core::option::Option::Some(value.into());
6075 self
6076 }
6077 pub fn fail_on_unsupported_field(mut self, value: bool) -> Self {
6079 self.fail_on_unsupported_field = ::core::option::Option::Some(value.into());
6080 self
6081 }
6082 pub fn fields(
6084 mut self,
6085 value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
6086 ) -> Self {
6087 self.fields = ::core::option::Option::Some(value.into());
6088 self
6089 }
6090 pub fn include(mut self, value: bool) -> Self {
6092 self.include = ::core::option::Option::Some(value.into());
6093 self
6094 }
6095 pub fn max_doc_freq(mut self, value: i32) -> Self {
6097 self.max_doc_freq = ::core::option::Option::Some(value.into());
6098 self
6099 }
6100 pub fn max_query_terms(mut self, value: i32) -> Self {
6102 self.max_query_terms = ::core::option::Option::Some(value.into());
6103 self
6104 }
6105 pub fn max_word_length(mut self, value: i32) -> Self {
6107 self.max_word_length = ::core::option::Option::Some(value.into());
6108 self
6109 }
6110 pub fn min_doc_freq(mut self, value: i32) -> Self {
6112 self.min_doc_freq = ::core::option::Option::Some(value.into());
6113 self
6114 }
6115 pub fn minimum_should_match(
6117 mut self,
6118 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
6119 ) -> Self {
6120 self.minimum_should_match = ::core::option::Option::Some(value.into());
6121 self
6122 }
6123 pub fn min_term_freq(mut self, value: i32) -> Self {
6125 self.min_term_freq = ::core::option::Option::Some(value.into());
6126 self
6127 }
6128 pub fn min_word_length(mut self, value: i32) -> Self {
6130 self.min_word_length = ::core::option::Option::Some(value.into());
6131 self
6132 }
6133 pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6135 self.routing = ::core::option::Option::Some(value.into());
6136 self
6137 }
6138 pub fn stop_words(
6140 mut self,
6141 value: impl ::core::convert::Into<crate::analysis::StopWords>,
6142 ) -> Self {
6143 self.stop_words = ::core::option::Option::Some(value.into());
6144 self
6145 }
6146 pub fn unlike(
6148 mut self,
6149 value: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
6150 ) -> Self {
6151 self.unlike = ::core::option::Option::Some(value.into());
6152 self
6153 }
6154 pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
6156 self.version = ::core::option::Option::Some(value.into());
6157 self
6158 }
6159 pub fn version_type(mut self, value: impl ::core::convert::Into<crate::VersionType>) -> Self {
6161 self.version_type = ::core::option::Option::Some(value.into());
6162 self
6163 }
6164}
6165
6166#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6167#[non_exhaustive]
6168pub struct MultiMatchQuery {
6169 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6174 pub boost: ::core::option::Option<f32>,
6175 #[serde(
6176 rename = "_name",
6177 skip_serializing_if = "::core::option::Option::is_none"
6178 )]
6179 pub name: ::core::option::Option<::std::string::String>,
6180 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6182 pub analyzer: ::core::option::Option<::std::string::String>,
6183 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6185 pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
6186 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6187 pub cutoff_frequency: ::core::option::Option<f64>,
6188 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6191 pub fields: ::core::option::Option<crate::Fields>,
6192 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6194 pub fuzziness: ::core::option::Option<crate::Fuzziness>,
6195 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6197 pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
6198 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6201 pub fuzzy_transpositions: ::core::option::Option<bool>,
6202 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6204 pub lenient: ::core::option::Option<bool>,
6205 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6207 pub max_expansions: ::core::option::Option<i32>,
6208 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6210 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
6211 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6213 pub operator: ::core::option::Option<crate::query_dsl::Operator>,
6214 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6216 pub prefix_length: ::core::option::Option<i32>,
6217 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6219 pub query: ::core::option::Option<::std::string::String>,
6220 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6222 pub slop: ::core::option::Option<i32>,
6223 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6225 pub tie_breaker: ::core::option::Option<f64>,
6226 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6228 pub r#type: ::core::option::Option<crate::query_dsl::TextQueryType>,
6229 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6231 pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
6232}
6233
6234impl MultiMatchQuery {
6235 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
6237 Self {
6238 boost: ::core::option::Option::None,
6239 name: ::core::option::Option::None,
6240 analyzer: ::core::option::Option::None,
6241 auto_generate_synonyms_phrase_query: ::core::option::Option::None,
6242 cutoff_frequency: ::core::option::Option::None,
6243 fields: ::core::option::Option::None,
6244 fuzziness: ::core::option::Option::None,
6245 fuzzy_rewrite: ::core::option::Option::None,
6246 fuzzy_transpositions: ::core::option::Option::None,
6247 lenient: ::core::option::Option::None,
6248 max_expansions: ::core::option::Option::None,
6249 minimum_should_match: ::core::option::Option::None,
6250 operator: ::core::option::Option::None,
6251 prefix_length: ::core::option::Option::None,
6252 query: ::core::option::Option::Some(query.into()),
6253 slop: ::core::option::Option::None,
6254 tie_breaker: ::core::option::Option::None,
6255 r#type: ::core::option::Option::None,
6256 zero_terms_query: ::core::option::Option::None,
6257 }
6258 }
6259}
6260
6261impl MultiMatchQuery {
6262 pub fn boost(mut self, value: f32) -> Self {
6264 self.boost = ::core::option::Option::Some(value.into());
6265 self
6266 }
6267 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6269 self.name = ::core::option::Option::Some(value.into());
6270 self
6271 }
6272 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6274 self.analyzer = ::core::option::Option::Some(value.into());
6275 self
6276 }
6277 pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
6279 self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
6280 self
6281 }
6282 pub fn cutoff_frequency(mut self, value: f64) -> Self {
6284 self.cutoff_frequency = ::core::option::Option::Some(value.into());
6285 self
6286 }
6287 pub fn fields(mut self, value: impl ::core::convert::Into<crate::Fields>) -> Self {
6289 self.fields = ::core::option::Option::Some(value.into());
6290 self
6291 }
6292 pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
6294 self.fuzziness = ::core::option::Option::Some(value.into());
6295 self
6296 }
6297 pub fn fuzzy_rewrite(
6299 mut self,
6300 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
6301 ) -> Self {
6302 self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
6303 self
6304 }
6305 pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
6307 self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
6308 self
6309 }
6310 pub fn lenient(mut self, value: bool) -> Self {
6312 self.lenient = ::core::option::Option::Some(value.into());
6313 self
6314 }
6315 pub fn max_expansions(mut self, value: i32) -> Self {
6317 self.max_expansions = ::core::option::Option::Some(value.into());
6318 self
6319 }
6320 pub fn minimum_should_match(
6322 mut self,
6323 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
6324 ) -> Self {
6325 self.minimum_should_match = ::core::option::Option::Some(value.into());
6326 self
6327 }
6328 pub fn operator(
6330 mut self,
6331 value: impl ::core::convert::Into<crate::query_dsl::Operator>,
6332 ) -> Self {
6333 self.operator = ::core::option::Option::Some(value.into());
6334 self
6335 }
6336 pub fn prefix_length(mut self, value: i32) -> Self {
6338 self.prefix_length = ::core::option::Option::Some(value.into());
6339 self
6340 }
6341 pub fn slop(mut self, value: i32) -> Self {
6343 self.slop = ::core::option::Option::Some(value.into());
6344 self
6345 }
6346 pub fn tie_breaker(mut self, value: f64) -> Self {
6348 self.tie_breaker = ::core::option::Option::Some(value.into());
6349 self
6350 }
6351 pub fn r#type(
6353 mut self,
6354 value: impl ::core::convert::Into<crate::query_dsl::TextQueryType>,
6355 ) -> Self {
6356 self.r#type = ::core::option::Option::Some(value.into());
6357 self
6358 }
6359 pub fn zero_terms_query(
6361 mut self,
6362 value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
6363 ) -> Self {
6364 self.zero_terms_query = ::core::option::Option::Some(value.into());
6365 self
6366 }
6367}
6368
6369#[derive(Clone, Debug, PartialEq, Eq, Hash)]
6370#[non_exhaustive]
6371pub enum MultiValueMode {
6372 Min,
6374 Max,
6376 Avg,
6378 Sum,
6380 Raw(::std::string::String),
6382}
6383
6384impl MultiValueMode {
6385 pub fn as_str(&self) -> &str {
6387 match self {
6388 Self::Min => "min",
6389 Self::Max => "max",
6390 Self::Avg => "avg",
6391 Self::Sum => "sum",
6392 Self::Raw(value) => value,
6393 }
6394 }
6395
6396 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
6398 match value {
6399 "min" => ::core::option::Option::Some(Self::Min),
6400 "max" => ::core::option::Option::Some(Self::Max),
6401 "avg" => ::core::option::Option::Some(Self::Avg),
6402 "sum" => ::core::option::Option::Some(Self::Sum),
6403 _ => ::core::option::Option::None,
6404 }
6405 }
6406}
6407
6408impl ::serde::Serialize for MultiValueMode {
6409 fn serialize<S__: ::serde::Serializer>(
6410 &self,
6411 serializer: S__,
6412 ) -> ::core::result::Result<S__::Ok, S__::Error> {
6413 serializer.serialize_str(self.as_str())
6414 }
6415}
6416
6417impl<'de> ::serde::Deserialize<'de> for MultiValueMode {
6418 fn deserialize<D__: ::serde::Deserializer<'de>>(
6419 deserializer: D__,
6420 ) -> ::core::result::Result<Self, D__::Error> {
6421 ::oxsearch_core::__private::deserialize_string_enum(
6422 deserializer,
6423 "MultiValueMode",
6424 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
6425 )
6426 }
6427}
6428
6429#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6430#[non_exhaustive]
6431pub struct NestedQuery {
6432 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6437 pub boost: ::core::option::Option<f32>,
6438 #[serde(
6439 rename = "_name",
6440 skip_serializing_if = "::core::option::Option::is_none"
6441 )]
6442 pub name: ::core::option::Option<::std::string::String>,
6443 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6445 pub ignore_unmapped: ::core::option::Option<bool>,
6446 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6448 pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
6449 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6451 pub path: ::core::option::Option<crate::Field>,
6452 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6454 pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
6455 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6457 pub score_mode: ::core::option::Option<crate::query_dsl::ChildScoreMode>,
6458}
6459
6460impl NestedQuery {
6461 pub fn new(
6463 path: impl ::core::convert::Into<crate::Field>,
6464 query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
6465 ) -> Self {
6466 Self {
6467 boost: ::core::option::Option::None,
6468 name: ::core::option::Option::None,
6469 ignore_unmapped: ::core::option::Option::None,
6470 inner_hits: ::core::option::Option::None,
6471 path: ::core::option::Option::Some(path.into()),
6472 query: ::core::option::Option::Some(query.into()),
6473 score_mode: ::core::option::Option::None,
6474 }
6475 }
6476}
6477
6478impl NestedQuery {
6479 pub fn boost(mut self, value: f32) -> Self {
6481 self.boost = ::core::option::Option::Some(value.into());
6482 self
6483 }
6484 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6486 self.name = ::core::option::Option::Some(value.into());
6487 self
6488 }
6489 pub fn ignore_unmapped(mut self, value: bool) -> Self {
6491 self.ignore_unmapped = ::core::option::Option::Some(value.into());
6492 self
6493 }
6494 pub fn inner_hits(
6496 mut self,
6497 value: impl ::core::convert::Into<crate::search::InnerHits>,
6498 ) -> Self {
6499 self.inner_hits = ::core::option::Option::Some(value.into());
6500 self
6501 }
6502 pub fn score_mode(
6504 mut self,
6505 value: impl ::core::convert::Into<crate::query_dsl::ChildScoreMode>,
6506 ) -> Self {
6507 self.score_mode = ::core::option::Option::Some(value.into());
6508 self
6509 }
6510}
6511
6512#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6513#[non_exhaustive]
6514pub struct NumberRangeQuery {
6515 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6520 pub boost: ::core::option::Option<f32>,
6521 #[serde(
6522 rename = "_name",
6523 skip_serializing_if = "::core::option::Option::is_none"
6524 )]
6525 pub name: ::core::option::Option<::std::string::String>,
6526 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6528 pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
6529 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6531 pub gt: ::core::option::Option<f64>,
6532 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6534 pub gte: ::core::option::Option<f64>,
6535 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6537 pub lt: ::core::option::Option<f64>,
6538 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6540 pub lte: ::core::option::Option<f64>,
6541}
6542
6543impl NumberRangeQuery {
6544 pub fn new() -> Self {
6546 Self {
6547 boost: ::core::option::Option::None,
6548 name: ::core::option::Option::None,
6549 relation: ::core::option::Option::None,
6550 gt: ::core::option::Option::None,
6551 gte: ::core::option::Option::None,
6552 lt: ::core::option::Option::None,
6553 lte: ::core::option::Option::None,
6554 }
6555 }
6556}
6557
6558impl NumberRangeQuery {
6559 pub fn boost(mut self, value: f32) -> Self {
6561 self.boost = ::core::option::Option::Some(value.into());
6562 self
6563 }
6564 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6566 self.name = ::core::option::Option::Some(value.into());
6567 self
6568 }
6569 pub fn relation(
6571 mut self,
6572 value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
6573 ) -> Self {
6574 self.relation = ::core::option::Option::Some(value.into());
6575 self
6576 }
6577 pub fn gt(mut self, value: f64) -> Self {
6579 self.gt = ::core::option::Option::Some(value.into());
6580 self
6581 }
6582 pub fn gte(mut self, value: f64) -> Self {
6584 self.gte = ::core::option::Option::Some(value.into());
6585 self
6586 }
6587 pub fn lt(mut self, value: f64) -> Self {
6589 self.lt = ::core::option::Option::Some(value.into());
6590 self
6591 }
6592 pub fn lte(mut self, value: f64) -> Self {
6594 self.lte = ::core::option::Option::Some(value.into());
6595 self
6596 }
6597}
6598
6599#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6600#[serde(
6601 try_from = "NumericDecayFunctionRepr",
6602 into = "NumericDecayFunctionRepr"
6603)]
6604#[non_exhaustive]
6605pub struct NumericDecayFunction {
6606 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6608 pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
6609 pub field: crate::Field,
6611 pub placement: crate::query_dsl::DecayPlacement<f64, f64>,
6613}
6614
6615impl NumericDecayFunction {
6616 pub fn new(
6618 field: impl ::core::convert::Into<crate::Field>,
6619 placement: impl ::core::convert::Into<crate::query_dsl::DecayPlacement<f64, f64>>,
6620 ) -> Self {
6621 Self {
6622 multi_value_mode: ::core::option::Option::None,
6623 field: field.into(),
6624 placement: placement.into(),
6625 }
6626 }
6627}
6628
6629impl NumericDecayFunction {
6630 pub fn multi_value_mode(
6632 mut self,
6633 value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
6634 ) -> Self {
6635 self.multi_value_mode = ::core::option::Option::Some(value.into());
6636 self
6637 }
6638}
6639
6640#[derive(::serde::Serialize, ::serde::Deserialize)]
6641struct NumericDecayFunctionRepr {
6642 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6644 multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
6645 #[serde(flatten)]
6646 keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::DecayPlacement<f64, f64>>,
6647}
6648
6649impl ::core::convert::TryFrom<NumericDecayFunctionRepr> for NumericDecayFunction {
6650 type Error = ::std::string::String;
6651 fn try_from(repr: NumericDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
6652 let mut keyed = repr.keyed__.into_iter();
6653 match (keyed.next(), keyed.next()) {
6654 (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
6655 ::core::result::Result::Ok(Self {
6656 multi_value_mode: repr.multi_value_mode,
6657 field,
6658 placement,
6659 })
6660 }
6661 _ => ::core::result::Result::Err(::std::string::String::from(
6662 "NumericDecayFunction needs exactly one property keyed by its field",
6663 )),
6664 }
6665 }
6666}
6667
6668impl ::core::convert::From<NumericDecayFunction> for NumericDecayFunctionRepr {
6669 fn from(value: NumericDecayFunction) -> Self {
6670 let mut keyed__ = ::indexmap::IndexMap::new();
6671 keyed__.insert(value.field, value.placement);
6672 Self {
6673 multi_value_mode: value.multi_value_mode,
6674 keyed__,
6675 }
6676 }
6677}
6678
6679#[derive(Clone, Debug, PartialEq, Eq, Hash)]
6680#[non_exhaustive]
6681pub enum Operator {
6682 And,
6684 Or,
6686 Raw(::std::string::String),
6688}
6689
6690impl Operator {
6691 pub fn as_str(&self) -> &str {
6693 match self {
6694 Self::And => "and",
6695 Self::Or => "or",
6696 Self::Raw(value) => value,
6697 }
6698 }
6699
6700 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
6702 match value {
6703 "and" | "AND" => ::core::option::Option::Some(Self::And),
6704 "or" | "OR" => ::core::option::Option::Some(Self::Or),
6705 _ => ::core::option::Option::None,
6706 }
6707 }
6708}
6709
6710impl ::serde::Serialize for Operator {
6711 fn serialize<S__: ::serde::Serializer>(
6712 &self,
6713 serializer: S__,
6714 ) -> ::core::result::Result<S__::Ok, S__::Error> {
6715 serializer.serialize_str(self.as_str())
6716 }
6717}
6718
6719impl<'de> ::serde::Deserialize<'de> for Operator {
6720 fn deserialize<D__: ::serde::Deserializer<'de>>(
6721 deserializer: D__,
6722 ) -> ::core::result::Result<Self, D__::Error> {
6723 ::oxsearch_core::__private::deserialize_string_enum(deserializer, "Operator", |value| {
6724 Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
6725 })
6726 }
6727}
6728
6729#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6730#[non_exhaustive]
6731pub struct ParentIdQuery {
6732 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6737 pub boost: ::core::option::Option<f32>,
6738 #[serde(
6739 rename = "_name",
6740 skip_serializing_if = "::core::option::Option::is_none"
6741 )]
6742 pub name: ::core::option::Option<::std::string::String>,
6743 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6745 pub id: ::core::option::Option<crate::Id>,
6746 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6748 pub ignore_unmapped: ::core::option::Option<bool>,
6749 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6751 pub r#type: ::core::option::Option<crate::RelationName>,
6752}
6753
6754impl ParentIdQuery {
6755 pub fn new() -> Self {
6757 Self {
6758 boost: ::core::option::Option::None,
6759 name: ::core::option::Option::None,
6760 id: ::core::option::Option::None,
6761 ignore_unmapped: ::core::option::Option::None,
6762 r#type: ::core::option::Option::None,
6763 }
6764 }
6765}
6766
6767impl ParentIdQuery {
6768 pub fn boost(mut self, value: f32) -> Self {
6770 self.boost = ::core::option::Option::Some(value.into());
6771 self
6772 }
6773 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6775 self.name = ::core::option::Option::Some(value.into());
6776 self
6777 }
6778 pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
6780 self.id = ::core::option::Option::Some(value.into());
6781 self
6782 }
6783 pub fn ignore_unmapped(mut self, value: bool) -> Self {
6785 self.ignore_unmapped = ::core::option::Option::Some(value.into());
6786 self
6787 }
6788 pub fn r#type(mut self, value: impl ::core::convert::Into<crate::RelationName>) -> Self {
6790 self.r#type = ::core::option::Option::Some(value.into());
6791 self
6792 }
6793}
6794
6795#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6796#[non_exhaustive]
6797pub struct PercolateQuery {
6798 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6803 pub boost: ::core::option::Option<f32>,
6804 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6805 pub _name: ::core::option::Option<::std::string::String>,
6806 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6808 pub document: ::core::option::Option<::serde_json::Value>,
6809 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6811 pub documents: ::core::option::Option<::std::vec::Vec<::serde_json::Value>>,
6812 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6814 pub field: ::core::option::Option<crate::Field>,
6815 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6817 pub id: ::core::option::Option<crate::Id>,
6818 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6820 pub index: ::core::option::Option<crate::IndexName>,
6821 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6823 pub name: ::core::option::Option<::std::string::String>,
6824 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6826 pub preference: ::core::option::Option<::std::string::String>,
6827 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6829 pub routing: ::core::option::Option<::std::string::String>,
6830 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6832 pub version: ::core::option::Option<crate::VersionNumber>,
6833}
6834
6835impl PercolateQuery {
6836 pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
6838 Self {
6839 boost: ::core::option::Option::None,
6840 _name: ::core::option::Option::None,
6841 document: ::core::option::Option::None,
6842 documents: ::core::option::Option::None,
6843 field: ::core::option::Option::Some(field.into()),
6844 id: ::core::option::Option::None,
6845 index: ::core::option::Option::None,
6846 name: ::core::option::Option::None,
6847 preference: ::core::option::Option::None,
6848 routing: ::core::option::Option::None,
6849 version: ::core::option::Option::None,
6850 }
6851 }
6852}
6853
6854impl PercolateQuery {
6855 pub fn boost(mut self, value: f32) -> Self {
6857 self.boost = ::core::option::Option::Some(value.into());
6858 self
6859 }
6860 pub fn _name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6862 self._name = ::core::option::Option::Some(value.into());
6863 self
6864 }
6865 pub fn document(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
6867 self.document = ::core::option::Option::Some(value.into());
6868 self
6869 }
6870 pub fn documents(
6872 mut self,
6873 value: impl ::core::convert::Into<::std::vec::Vec<::serde_json::Value>>,
6874 ) -> Self {
6875 self.documents = ::core::option::Option::Some(value.into());
6876 self
6877 }
6878 pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
6880 self.id = ::core::option::Option::Some(value.into());
6881 self
6882 }
6883 pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
6885 self.index = ::core::option::Option::Some(value.into());
6886 self
6887 }
6888 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6890 self.name = ::core::option::Option::Some(value.into());
6891 self
6892 }
6893 pub fn preference(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6895 self.preference = ::core::option::Option::Some(value.into());
6896 self
6897 }
6898 pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6900 self.routing = ::core::option::Option::Some(value.into());
6901 self
6902 }
6903 pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
6905 self.version = ::core::option::Option::Some(value.into());
6906 self
6907 }
6908}
6909
6910#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6911#[non_exhaustive]
6912pub struct PinnedDoc {
6913 #[serde(
6915 rename = "_id",
6916 skip_serializing_if = "::core::option::Option::is_none"
6917 )]
6918 pub id: ::core::option::Option<crate::Id>,
6919 #[serde(
6921 rename = "_index",
6922 skip_serializing_if = "::core::option::Option::is_none"
6923 )]
6924 pub index: ::core::option::Option<crate::IndexName>,
6925}
6926
6927impl PinnedDoc {
6928 pub fn new(id: impl ::core::convert::Into<crate::Id>) -> Self {
6930 Self {
6931 id: ::core::option::Option::Some(id.into()),
6932 index: ::core::option::Option::None,
6933 }
6934 }
6935}
6936
6937impl PinnedDoc {
6938 pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
6940 self.index = ::core::option::Option::Some(value.into());
6941 self
6942 }
6943}
6944
6945#[derive(Clone, Debug, PartialEq)]
6947#[non_exhaustive]
6948pub enum PinnedQueryVariant {
6949 Ids(::std::vec::Vec<crate::Id>),
6952 Docs(::std::vec::Vec<crate::query_dsl::PinnedDoc>),
6955 Raw(::serde_json::Value),
6957}
6958
6959impl PinnedQueryVariant {
6960 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
6962 &self,
6963 map: &mut M__,
6964 ) -> ::core::result::Result<(), M__::Error> {
6965 match self {
6966 Self::Ids(value) => map.serialize_entry("ids", value),
6967 Self::Docs(value) => map.serialize_entry("docs", value),
6968 Self::Raw(value) => match value {
6969 ::serde_json::Value::Object(entries) => {
6970 for (key, value) in entries {
6971 map.serialize_entry(key, value)?;
6972 }
6973 ::core::result::Result::Ok(())
6974 }
6975 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
6976 "a raw variant must be an object",
6977 )),
6978 },
6979 }
6980 }
6981}
6982
6983impl ::serde::Serialize for PinnedQueryVariant {
6984 fn serialize<S__: ::serde::Serializer>(
6985 &self,
6986 serializer: S__,
6987 ) -> ::core::result::Result<S__::Ok, S__::Error> {
6988 match self {
6989 Self::Ids(value) => {
6990 ::oxsearch_core::__private::serialize_variant(serializer, "ids", value)
6991 }
6992 Self::Docs(value) => {
6993 ::oxsearch_core::__private::serialize_variant(serializer, "docs", value)
6994 }
6995 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
6996 }
6997 }
6998}
6999
7000impl<'de> ::serde::Deserialize<'de> for PinnedQueryVariant {
7001 fn deserialize<D__: ::serde::Deserializer<'de>>(
7002 deserializer: D__,
7003 ) -> ::core::result::Result<Self, D__::Error> {
7004 ::oxsearch_core::__private::deserialize_container(deserializer)
7005 }
7006}
7007
7008impl<'de> ::oxsearch_core::__private::Container<'de> for PinnedQueryVariant {
7009 const NAME: &'static str = "PinnedQueryVariant";
7010 fn variant<A__: ::serde::de::MapAccess<'de>>(
7011 key: &str,
7012 map: &mut A__,
7013 ) -> ::core::result::Result<Self, A__::Error> {
7014 ::core::result::Result::Ok(match key {
7015 "ids" => Self::Ids(map.next_value()?),
7016 "docs" => Self::Docs(map.next_value()?),
7017 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
7018 key,
7019 map.next_value()?,
7020 )),
7021 })
7022 }
7023}
7024
7025impl ::core::convert::From<::std::vec::Vec<crate::Id>> for PinnedQueryVariant {
7026 fn from(value: ::std::vec::Vec<crate::Id>) -> Self {
7027 Self::Ids(value)
7028 }
7029}
7030
7031impl ::core::convert::From<::std::vec::Vec<crate::query_dsl::PinnedDoc>> for PinnedQueryVariant {
7032 fn from(value: ::std::vec::Vec<crate::query_dsl::PinnedDoc>) -> Self {
7033 Self::Docs(value)
7034 }
7035}
7036
7037#[derive(Clone, Debug, PartialEq)]
7038#[non_exhaustive]
7039pub struct PinnedQuery {
7040 pub boost: ::core::option::Option<f32>,
7045 pub name: ::core::option::Option<::std::string::String>,
7046 pub organic: ::core::option::Option<crate::query_dsl::QueryContainer>,
7048 pub variant: ::core::option::Option<crate::query_dsl::PinnedQueryVariant>,
7050}
7051
7052impl PinnedQuery {
7053 pub fn new(organic: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
7055 Self {
7056 boost: ::core::option::Option::None,
7057 name: ::core::option::Option::None,
7058 organic: ::core::option::Option::Some(organic.into()),
7059 variant: ::core::option::Option::None,
7060 }
7061 }
7062}
7063
7064impl PinnedQuery {
7065 pub fn boost(mut self, value: f32) -> Self {
7067 self.boost = ::core::option::Option::Some(value.into());
7068 self
7069 }
7070 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7072 self.name = ::core::option::Option::Some(value.into());
7073 self
7074 }
7075 pub fn variant(
7077 mut self,
7078 value: impl ::core::convert::Into<crate::query_dsl::PinnedQueryVariant>,
7079 ) -> Self {
7080 self.variant = ::core::option::Option::Some(value.into());
7081 self
7082 }
7083}
7084
7085impl ::serde::Serialize for PinnedQuery {
7086 fn serialize<S__: ::serde::Serializer>(
7087 &self,
7088 serializer: S__,
7089 ) -> ::core::result::Result<S__::Ok, S__::Error> {
7090 use ::serde::ser::SerializeMap as _;
7091 let mut map = serializer.serialize_map(::core::option::Option::None)?;
7092 if let ::core::option::Option::Some(value) = &self.boost {
7093 map.serialize_entry("boost", value)?;
7094 }
7095 if let ::core::option::Option::Some(value) = &self.name {
7096 map.serialize_entry("_name", value)?;
7097 }
7098 if let ::core::option::Option::Some(value) = &self.organic {
7099 map.serialize_entry("organic", value)?;
7100 }
7101 if let ::core::option::Option::Some(variant) = &self.variant {
7102 variant.serialize_entry(&mut map)?;
7103 }
7104 map.end()
7105 }
7106}
7107
7108impl<'de> ::serde::Deserialize<'de> for PinnedQuery {
7109 fn deserialize<D__: ::serde::Deserializer<'de>>(
7110 deserializer: D__,
7111 ) -> ::core::result::Result<Self, D__::Error> {
7112 struct Fields;
7113 impl<'de> ::serde::de::Visitor<'de> for Fields {
7114 type Value = PinnedQuery;
7115 fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7116 f.write_str("a PinnedQuery object")
7117 }
7118 fn visit_map<A__: ::serde::de::MapAccess<'de>>(
7119 self,
7120 mut map: A__,
7121 ) -> ::core::result::Result<PinnedQuery, A__::Error> {
7122 let mut boost = ::core::option::Option::None;
7123 let mut name = ::core::option::Option::None;
7124 let mut organic = ::core::option::Option::None;
7125 let mut variant__ = ::core::option::Option::None;
7126 while let ::core::option::Option::Some(key) =
7127 map.next_key::<::std::string::String>()?
7128 {
7129 match key.as_str() {
7130 "boost" => boost = ::core::option::Option::Some(map.next_value()?),
7131 "_name" => name = ::core::option::Option::Some(map.next_value()?),
7132 "organic" => organic = ::core::option::Option::Some(map.next_value()?),
7133 _ => {
7134 if variant__.is_some() {
7135 return ::core::result::Result::Err(
7136 ::oxsearch_core::__private::two_variants("PinnedQuery", &key),
7137 );
7138 }
7139 variant__ = ::core::option::Option::Some(
7140 <PinnedQueryVariant as ::oxsearch_core::__private::Container<
7141 'de,
7142 >>::variant(&key, &mut map)?,
7143 );
7144 }
7145 }
7146 }
7147 ::core::result::Result::Ok(PinnedQuery {
7148 boost,
7149 name,
7150 organic,
7151 variant: variant__,
7152 })
7153 }
7154 }
7155 deserializer.deserialize_map(Fields)
7156 }
7157}
7158
7159#[derive(Clone, Debug, PartialEq)]
7160#[non_exhaustive]
7161pub struct PrefixQuery {
7162 pub boost: ::core::option::Option<f32>,
7167 pub name: ::core::option::Option<::std::string::String>,
7168 pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
7170 pub value: ::core::option::Option<::std::string::String>,
7172 pub case_insensitive: ::core::option::Option<bool>,
7175}
7176
7177impl PrefixQuery {
7178 pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
7180 Self {
7181 boost: ::core::option::Option::None,
7182 name: ::core::option::Option::None,
7183 rewrite: ::core::option::Option::None,
7184 value: ::core::option::Option::Some(value.into()),
7185 case_insensitive: ::core::option::Option::None,
7186 }
7187 }
7188}
7189
7190impl PrefixQuery {
7191 pub fn boost(mut self, value: f32) -> Self {
7193 self.boost = ::core::option::Option::Some(value.into());
7194 self
7195 }
7196 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7198 self.name = ::core::option::Option::Some(value.into());
7199 self
7200 }
7201 pub fn rewrite(
7203 mut self,
7204 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
7205 ) -> Self {
7206 self.rewrite = ::core::option::Option::Some(value.into());
7207 self
7208 }
7209 pub fn case_insensitive(mut self, value: bool) -> Self {
7211 self.case_insensitive = ::core::option::Option::Some(value.into());
7212 self
7213 }
7214}
7215
7216#[derive(::serde::Serialize, ::serde::Deserialize)]
7217#[serde(remote = "PrefixQuery")]
7218struct PrefixQueryDef {
7219 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7224 boost: ::core::option::Option<f32>,
7225 #[serde(
7226 rename = "_name",
7227 skip_serializing_if = "::core::option::Option::is_none"
7228 )]
7229 name: ::core::option::Option<::std::string::String>,
7230 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7232 rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
7233 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7235 value: ::core::option::Option<::std::string::String>,
7236 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7239 case_insensitive: ::core::option::Option<bool>,
7240}
7241
7242impl ::serde::Serialize for PrefixQuery {
7243 fn serialize<S__: ::serde::Serializer>(
7244 &self,
7245 serializer: S__,
7246 ) -> ::core::result::Result<S__::Ok, S__::Error> {
7247 if let (::core::option::Option::Some(short), true) = (
7248 &self.value,
7249 self.boost.is_none()
7250 && self.name.is_none()
7251 && self.rewrite.is_none()
7252 && self.case_insensitive.is_none(),
7253 ) {
7254 return ::serde::Serialize::serialize(short, serializer);
7255 }
7256 PrefixQueryDef::serialize(self, serializer)
7257 }
7258}
7259
7260impl<'de> ::oxsearch_core::__private::Shorthand<'de> for PrefixQuery {
7261 type Short = ::std::string::String;
7262 fn from_short(short: ::std::string::String) -> Self {
7263 Self {
7264 boost: ::core::option::Option::None,
7265 name: ::core::option::Option::None,
7266 rewrite: ::core::option::Option::None,
7267 value: ::core::option::Option::Some(short),
7268 case_insensitive: ::core::option::Option::None,
7269 }
7270 }
7271 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
7272 deserializer: D__,
7273 ) -> ::core::result::Result<Self, D__::Error> {
7274 PrefixQueryDef::deserialize(deserializer)
7275 }
7276}
7277
7278impl<'de> ::serde::Deserialize<'de> for PrefixQuery {
7279 fn deserialize<D__: ::serde::Deserializer<'de>>(
7280 deserializer: D__,
7281 ) -> ::core::result::Result<Self, D__::Error> {
7282 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
7283 }
7284}
7285
7286#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7287#[non_exhaustive]
7288pub struct QueryBase {
7289 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7294 pub boost: ::core::option::Option<f32>,
7295 #[serde(
7296 rename = "_name",
7297 skip_serializing_if = "::core::option::Option::is_none"
7298 )]
7299 pub name: ::core::option::Option<::std::string::String>,
7300}
7301
7302impl QueryBase {
7303 pub fn new() -> Self {
7305 Self {
7306 boost: ::core::option::Option::None,
7307 name: ::core::option::Option::None,
7308 }
7309 }
7310}
7311
7312impl QueryBase {
7313 pub fn boost(mut self, value: f32) -> Self {
7315 self.boost = ::core::option::Option::Some(value.into());
7316 self
7317 }
7318 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7320 self.name = ::core::option::Option::Some(value.into());
7321 self
7322 }
7323}
7324
7325#[derive(Clone, Debug, PartialEq)]
7327#[non_exhaustive]
7328pub enum QueryContainer {
7329 Bool(::std::boxed::Box<crate::query_dsl::BoolQuery>),
7331 Boosting(::std::boxed::Box<crate::query_dsl::BoostingQuery>),
7333 Common(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>),
7334 CombinedFields(crate::query_dsl::CombinedFieldsQuery),
7336 ConstantScore(::std::boxed::Box<crate::query_dsl::ConstantScoreQuery>),
7338 DisMax(crate::query_dsl::DisMaxQuery),
7341 DistanceFeature(crate::query_dsl::DistanceFeatureQuery),
7344 Exists(crate::query_dsl::ExistsQuery),
7346 FunctionScore(::std::boxed::Box<crate::query_dsl::FunctionScoreQuery>),
7348 Fuzzy(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>),
7350 GeoBoundingBox(crate::query_dsl::GeoBoundingBoxQuery),
7352 GeoDistance(crate::query_dsl::GeoDistanceQuery),
7354 GeoGrid(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>),
7356 GeoPolygon(crate::query_dsl::GeoPolygonQuery),
7357 GeoShape(crate::query_dsl::GeoShapeQuery),
7359 HasChild(::std::boxed::Box<crate::query_dsl::HasChildQuery>),
7361 HasParent(::std::boxed::Box<crate::query_dsl::HasParentQuery>),
7363 Ids(crate::query_dsl::IdsQuery),
7366 Intervals(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>),
7368 Knn(::std::boxed::Box<crate::KnnQuery>),
7372 Kql(crate::query_dsl::KqlQuery),
7375 Match(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>),
7378 MatchAll(crate::query_dsl::MatchAllQuery),
7380 MatchBoolPrefix(
7384 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchBoolPrefixQuery>,
7385 ),
7386 MatchNone(crate::query_dsl::MatchNoneQuery),
7388 MatchPhrase(
7390 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
7391 ),
7392 MatchPhrasePrefix(
7395 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhrasePrefixQuery>,
7396 ),
7397 MoreLikeThis(crate::query_dsl::MoreLikeThisQuery),
7399 MultiMatch(crate::query_dsl::MultiMatchQuery),
7402 Nested(::std::boxed::Box<crate::query_dsl::NestedQuery>),
7405 ParentId(crate::query_dsl::ParentIdQuery),
7407 Percolate(crate::query_dsl::PercolateQuery),
7409 Pinned(::std::boxed::Box<crate::query_dsl::PinnedQuery>),
7411 Prefix(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>),
7413 QueryString(crate::query_dsl::QueryStringQuery),
7415 Range(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>),
7417 RankFeature(crate::query_dsl::RankFeatureQuery),
7419 Regexp(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>),
7421 Rule(::std::boxed::Box<crate::query_dsl::RuleQuery>),
7422 Script(crate::query_dsl::ScriptQuery),
7425 ScriptScore(::std::boxed::Box<crate::query_dsl::ScriptScoreQuery>),
7427 Semantic(crate::query_dsl::SemanticQuery),
7429 Shape(crate::query_dsl::ShapeQuery),
7431 SimpleQueryString(crate::query_dsl::SimpleQueryStringQuery),
7433 SpanContaining(::std::boxed::Box<crate::query_dsl::SpanContainingQuery>),
7435 SpanFieldMasking(::std::boxed::Box<crate::query_dsl::SpanFieldMaskingQuery>),
7437 SpanFirst(::std::boxed::Box<crate::query_dsl::SpanFirstQuery>),
7439 SpanMulti(::std::boxed::Box<crate::query_dsl::SpanMultiTermQuery>),
7441 SpanNear(crate::query_dsl::SpanNearQuery),
7444 SpanNot(::std::boxed::Box<crate::query_dsl::SpanNotQuery>),
7446 SpanOr(crate::query_dsl::SpanOrQuery),
7448 SpanTerm(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>),
7450 SpanWithin(::std::boxed::Box<crate::query_dsl::SpanWithinQuery>),
7452 SparseVector(crate::query_dsl::SparseVectorQuery),
7454 Term(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>),
7457 Terms(crate::query_dsl::TermsQuery),
7460 TermsSet(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>),
7463 TextExpansion(
7465 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TextExpansionQuery>,
7466 ),
7467 WeightedTokens(
7469 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WeightedTokensQuery>,
7470 ),
7471 Wildcard(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>),
7473 Wrapper(crate::query_dsl::WrapperQuery),
7475 Type(crate::query_dsl::TypeQuery),
7476 Raw(::serde_json::Value),
7478}
7479
7480impl QueryContainer {
7481 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
7483 &self,
7484 map: &mut M__,
7485 ) -> ::core::result::Result<(), M__::Error> {
7486 match self {
7487 Self::Bool(value) => map.serialize_entry("bool", value),
7488 Self::Boosting(value) => map.serialize_entry("boosting", value),
7489 Self::Common(value) => map.serialize_entry("common", value),
7490 Self::CombinedFields(value) => map.serialize_entry("combined_fields", value),
7491 Self::ConstantScore(value) => map.serialize_entry("constant_score", value),
7492 Self::DisMax(value) => map.serialize_entry("dis_max", value),
7493 Self::DistanceFeature(value) => map.serialize_entry("distance_feature", value),
7494 Self::Exists(value) => map.serialize_entry("exists", value),
7495 Self::FunctionScore(value) => map.serialize_entry("function_score", value),
7496 Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
7497 Self::GeoBoundingBox(value) => map.serialize_entry("geo_bounding_box", value),
7498 Self::GeoDistance(value) => map.serialize_entry("geo_distance", value),
7499 Self::GeoGrid(value) => map.serialize_entry("geo_grid", value),
7500 Self::GeoPolygon(value) => map.serialize_entry("geo_polygon", value),
7501 Self::GeoShape(value) => map.serialize_entry("geo_shape", value),
7502 Self::HasChild(value) => map.serialize_entry("has_child", value),
7503 Self::HasParent(value) => map.serialize_entry("has_parent", value),
7504 Self::Ids(value) => map.serialize_entry("ids", value),
7505 Self::Intervals(value) => map.serialize_entry("intervals", value),
7506 Self::Knn(value) => map.serialize_entry("knn", value),
7507 Self::Kql(value) => map.serialize_entry("kql", value),
7508 Self::Match(value) => map.serialize_entry("match", value),
7509 Self::MatchAll(value) => map.serialize_entry("match_all", value),
7510 Self::MatchBoolPrefix(value) => map.serialize_entry("match_bool_prefix", value),
7511 Self::MatchNone(value) => map.serialize_entry("match_none", value),
7512 Self::MatchPhrase(value) => map.serialize_entry("match_phrase", value),
7513 Self::MatchPhrasePrefix(value) => map.serialize_entry("match_phrase_prefix", value),
7514 Self::MoreLikeThis(value) => map.serialize_entry("more_like_this", value),
7515 Self::MultiMatch(value) => map.serialize_entry("multi_match", value),
7516 Self::Nested(value) => map.serialize_entry("nested", value),
7517 Self::ParentId(value) => map.serialize_entry("parent_id", value),
7518 Self::Percolate(value) => map.serialize_entry("percolate", value),
7519 Self::Pinned(value) => map.serialize_entry("pinned", value),
7520 Self::Prefix(value) => map.serialize_entry("prefix", value),
7521 Self::QueryString(value) => map.serialize_entry("query_string", value),
7522 Self::Range(value) => map.serialize_entry("range", value),
7523 Self::RankFeature(value) => map.serialize_entry("rank_feature", value),
7524 Self::Regexp(value) => map.serialize_entry("regexp", value),
7525 Self::Rule(value) => map.serialize_entry("rule", value),
7526 Self::Script(value) => map.serialize_entry("script", value),
7527 Self::ScriptScore(value) => map.serialize_entry("script_score", value),
7528 Self::Semantic(value) => map.serialize_entry("semantic", value),
7529 Self::Shape(value) => map.serialize_entry("shape", value),
7530 Self::SimpleQueryString(value) => map.serialize_entry("simple_query_string", value),
7531 Self::SpanContaining(value) => map.serialize_entry("span_containing", value),
7532 Self::SpanFieldMasking(value) => map.serialize_entry("span_field_masking", value),
7533 Self::SpanFirst(value) => map.serialize_entry("span_first", value),
7534 Self::SpanMulti(value) => map.serialize_entry("span_multi", value),
7535 Self::SpanNear(value) => map.serialize_entry("span_near", value),
7536 Self::SpanNot(value) => map.serialize_entry("span_not", value),
7537 Self::SpanOr(value) => map.serialize_entry("span_or", value),
7538 Self::SpanTerm(value) => map.serialize_entry("span_term", value),
7539 Self::SpanWithin(value) => map.serialize_entry("span_within", value),
7540 Self::SparseVector(value) => map.serialize_entry("sparse_vector", value),
7541 Self::Term(value) => map.serialize_entry("term", value),
7542 Self::Terms(value) => map.serialize_entry("terms", value),
7543 Self::TermsSet(value) => map.serialize_entry("terms_set", value),
7544 Self::TextExpansion(value) => map.serialize_entry("text_expansion", value),
7545 Self::WeightedTokens(value) => map.serialize_entry("weighted_tokens", value),
7546 Self::Wildcard(value) => map.serialize_entry("wildcard", value),
7547 Self::Wrapper(value) => map.serialize_entry("wrapper", value),
7548 Self::Type(value) => map.serialize_entry("type", value),
7549 Self::Raw(value) => match value {
7550 ::serde_json::Value::Object(entries) => {
7551 for (key, value) in entries {
7552 map.serialize_entry(key, value)?;
7553 }
7554 ::core::result::Result::Ok(())
7555 }
7556 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
7557 "a raw variant must be an object",
7558 )),
7559 },
7560 }
7561 }
7562}
7563
7564impl ::serde::Serialize for QueryContainer {
7565 fn serialize<S__: ::serde::Serializer>(
7566 &self,
7567 serializer: S__,
7568 ) -> ::core::result::Result<S__::Ok, S__::Error> {
7569 match self {
7570 Self::Bool(value) => {
7571 ::oxsearch_core::__private::serialize_variant(serializer, "bool", value)
7572 }
7573 Self::Boosting(value) => {
7574 ::oxsearch_core::__private::serialize_variant(serializer, "boosting", value)
7575 }
7576 Self::Common(value) => {
7577 ::oxsearch_core::__private::serialize_variant(serializer, "common", value)
7578 }
7579 Self::CombinedFields(value) => {
7580 ::oxsearch_core::__private::serialize_variant(serializer, "combined_fields", value)
7581 }
7582 Self::ConstantScore(value) => {
7583 ::oxsearch_core::__private::serialize_variant(serializer, "constant_score", value)
7584 }
7585 Self::DisMax(value) => {
7586 ::oxsearch_core::__private::serialize_variant(serializer, "dis_max", value)
7587 }
7588 Self::DistanceFeature(value) => {
7589 ::oxsearch_core::__private::serialize_variant(serializer, "distance_feature", value)
7590 }
7591 Self::Exists(value) => {
7592 ::oxsearch_core::__private::serialize_variant(serializer, "exists", value)
7593 }
7594 Self::FunctionScore(value) => {
7595 ::oxsearch_core::__private::serialize_variant(serializer, "function_score", value)
7596 }
7597 Self::Fuzzy(value) => {
7598 ::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
7599 }
7600 Self::GeoBoundingBox(value) => {
7601 ::oxsearch_core::__private::serialize_variant(serializer, "geo_bounding_box", value)
7602 }
7603 Self::GeoDistance(value) => {
7604 ::oxsearch_core::__private::serialize_variant(serializer, "geo_distance", value)
7605 }
7606 Self::GeoGrid(value) => {
7607 ::oxsearch_core::__private::serialize_variant(serializer, "geo_grid", value)
7608 }
7609 Self::GeoPolygon(value) => {
7610 ::oxsearch_core::__private::serialize_variant(serializer, "geo_polygon", value)
7611 }
7612 Self::GeoShape(value) => {
7613 ::oxsearch_core::__private::serialize_variant(serializer, "geo_shape", value)
7614 }
7615 Self::HasChild(value) => {
7616 ::oxsearch_core::__private::serialize_variant(serializer, "has_child", value)
7617 }
7618 Self::HasParent(value) => {
7619 ::oxsearch_core::__private::serialize_variant(serializer, "has_parent", value)
7620 }
7621 Self::Ids(value) => {
7622 ::oxsearch_core::__private::serialize_variant(serializer, "ids", value)
7623 }
7624 Self::Intervals(value) => {
7625 ::oxsearch_core::__private::serialize_variant(serializer, "intervals", value)
7626 }
7627 Self::Knn(value) => {
7628 ::oxsearch_core::__private::serialize_variant(serializer, "knn", value)
7629 }
7630 Self::Kql(value) => {
7631 ::oxsearch_core::__private::serialize_variant(serializer, "kql", value)
7632 }
7633 Self::Match(value) => {
7634 ::oxsearch_core::__private::serialize_variant(serializer, "match", value)
7635 }
7636 Self::MatchAll(value) => {
7637 ::oxsearch_core::__private::serialize_variant(serializer, "match_all", value)
7638 }
7639 Self::MatchBoolPrefix(value) => ::oxsearch_core::__private::serialize_variant(
7640 serializer,
7641 "match_bool_prefix",
7642 value,
7643 ),
7644 Self::MatchNone(value) => {
7645 ::oxsearch_core::__private::serialize_variant(serializer, "match_none", value)
7646 }
7647 Self::MatchPhrase(value) => {
7648 ::oxsearch_core::__private::serialize_variant(serializer, "match_phrase", value)
7649 }
7650 Self::MatchPhrasePrefix(value) => ::oxsearch_core::__private::serialize_variant(
7651 serializer,
7652 "match_phrase_prefix",
7653 value,
7654 ),
7655 Self::MoreLikeThis(value) => {
7656 ::oxsearch_core::__private::serialize_variant(serializer, "more_like_this", value)
7657 }
7658 Self::MultiMatch(value) => {
7659 ::oxsearch_core::__private::serialize_variant(serializer, "multi_match", value)
7660 }
7661 Self::Nested(value) => {
7662 ::oxsearch_core::__private::serialize_variant(serializer, "nested", value)
7663 }
7664 Self::ParentId(value) => {
7665 ::oxsearch_core::__private::serialize_variant(serializer, "parent_id", value)
7666 }
7667 Self::Percolate(value) => {
7668 ::oxsearch_core::__private::serialize_variant(serializer, "percolate", value)
7669 }
7670 Self::Pinned(value) => {
7671 ::oxsearch_core::__private::serialize_variant(serializer, "pinned", value)
7672 }
7673 Self::Prefix(value) => {
7674 ::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
7675 }
7676 Self::QueryString(value) => {
7677 ::oxsearch_core::__private::serialize_variant(serializer, "query_string", value)
7678 }
7679 Self::Range(value) => {
7680 ::oxsearch_core::__private::serialize_variant(serializer, "range", value)
7681 }
7682 Self::RankFeature(value) => {
7683 ::oxsearch_core::__private::serialize_variant(serializer, "rank_feature", value)
7684 }
7685 Self::Regexp(value) => {
7686 ::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
7687 }
7688 Self::Rule(value) => {
7689 ::oxsearch_core::__private::serialize_variant(serializer, "rule", value)
7690 }
7691 Self::Script(value) => {
7692 ::oxsearch_core::__private::serialize_variant(serializer, "script", value)
7693 }
7694 Self::ScriptScore(value) => {
7695 ::oxsearch_core::__private::serialize_variant(serializer, "script_score", value)
7696 }
7697 Self::Semantic(value) => {
7698 ::oxsearch_core::__private::serialize_variant(serializer, "semantic", value)
7699 }
7700 Self::Shape(value) => {
7701 ::oxsearch_core::__private::serialize_variant(serializer, "shape", value)
7702 }
7703 Self::SimpleQueryString(value) => ::oxsearch_core::__private::serialize_variant(
7704 serializer,
7705 "simple_query_string",
7706 value,
7707 ),
7708 Self::SpanContaining(value) => {
7709 ::oxsearch_core::__private::serialize_variant(serializer, "span_containing", value)
7710 }
7711 Self::SpanFieldMasking(value) => ::oxsearch_core::__private::serialize_variant(
7712 serializer,
7713 "span_field_masking",
7714 value,
7715 ),
7716 Self::SpanFirst(value) => {
7717 ::oxsearch_core::__private::serialize_variant(serializer, "span_first", value)
7718 }
7719 Self::SpanMulti(value) => {
7720 ::oxsearch_core::__private::serialize_variant(serializer, "span_multi", value)
7721 }
7722 Self::SpanNear(value) => {
7723 ::oxsearch_core::__private::serialize_variant(serializer, "span_near", value)
7724 }
7725 Self::SpanNot(value) => {
7726 ::oxsearch_core::__private::serialize_variant(serializer, "span_not", value)
7727 }
7728 Self::SpanOr(value) => {
7729 ::oxsearch_core::__private::serialize_variant(serializer, "span_or", value)
7730 }
7731 Self::SpanTerm(value) => {
7732 ::oxsearch_core::__private::serialize_variant(serializer, "span_term", value)
7733 }
7734 Self::SpanWithin(value) => {
7735 ::oxsearch_core::__private::serialize_variant(serializer, "span_within", value)
7736 }
7737 Self::SparseVector(value) => {
7738 ::oxsearch_core::__private::serialize_variant(serializer, "sparse_vector", value)
7739 }
7740 Self::Term(value) => {
7741 ::oxsearch_core::__private::serialize_variant(serializer, "term", value)
7742 }
7743 Self::Terms(value) => {
7744 ::oxsearch_core::__private::serialize_variant(serializer, "terms", value)
7745 }
7746 Self::TermsSet(value) => {
7747 ::oxsearch_core::__private::serialize_variant(serializer, "terms_set", value)
7748 }
7749 Self::TextExpansion(value) => {
7750 ::oxsearch_core::__private::serialize_variant(serializer, "text_expansion", value)
7751 }
7752 Self::WeightedTokens(value) => {
7753 ::oxsearch_core::__private::serialize_variant(serializer, "weighted_tokens", value)
7754 }
7755 Self::Wildcard(value) => {
7756 ::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
7757 }
7758 Self::Wrapper(value) => {
7759 ::oxsearch_core::__private::serialize_variant(serializer, "wrapper", value)
7760 }
7761 Self::Type(value) => {
7762 ::oxsearch_core::__private::serialize_variant(serializer, "type", value)
7763 }
7764 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
7765 }
7766 }
7767}
7768
7769impl<'de> ::serde::Deserialize<'de> for QueryContainer {
7770 fn deserialize<D__: ::serde::Deserializer<'de>>(
7771 deserializer: D__,
7772 ) -> ::core::result::Result<Self, D__::Error> {
7773 ::oxsearch_core::__private::deserialize_container(deserializer)
7774 }
7775}
7776
7777impl<'de> ::oxsearch_core::__private::Container<'de> for QueryContainer {
7778 const NAME: &'static str = "QueryContainer";
7779 fn variant<A__: ::serde::de::MapAccess<'de>>(
7780 key: &str,
7781 map: &mut A__,
7782 ) -> ::core::result::Result<Self, A__::Error> {
7783 ::core::result::Result::Ok(match key {
7784 "bool" => Self::Bool(map.next_value()?),
7785 "boosting" => Self::Boosting(map.next_value()?),
7786 "common" => Self::Common(map.next_value()?),
7787 "combined_fields" => Self::CombinedFields(map.next_value()?),
7788 "constant_score" => Self::ConstantScore(map.next_value()?),
7789 "dis_max" => Self::DisMax(map.next_value()?),
7790 "distance_feature" => Self::DistanceFeature(map.next_value()?),
7791 "exists" => Self::Exists(map.next_value()?),
7792 "function_score" => Self::FunctionScore(map.next_value()?),
7793 "fuzzy" => Self::Fuzzy(map.next_value()?),
7794 "geo_bounding_box" => Self::GeoBoundingBox(map.next_value()?),
7795 "geo_distance" => Self::GeoDistance(map.next_value()?),
7796 "geo_grid" => Self::GeoGrid(map.next_value()?),
7797 "geo_polygon" => Self::GeoPolygon(map.next_value()?),
7798 "geo_shape" => Self::GeoShape(map.next_value()?),
7799 "has_child" => Self::HasChild(map.next_value()?),
7800 "has_parent" => Self::HasParent(map.next_value()?),
7801 "ids" => Self::Ids(map.next_value()?),
7802 "intervals" => Self::Intervals(map.next_value()?),
7803 "knn" => Self::Knn(map.next_value()?),
7804 "kql" => Self::Kql(map.next_value()?),
7805 "match" => Self::Match(map.next_value()?),
7806 "match_all" => Self::MatchAll(map.next_value()?),
7807 "match_bool_prefix" => Self::MatchBoolPrefix(map.next_value()?),
7808 "match_none" => Self::MatchNone(map.next_value()?),
7809 "match_phrase" => Self::MatchPhrase(map.next_value()?),
7810 "match_phrase_prefix" => Self::MatchPhrasePrefix(map.next_value()?),
7811 "more_like_this" => Self::MoreLikeThis(map.next_value()?),
7812 "multi_match" => Self::MultiMatch(map.next_value()?),
7813 "nested" => Self::Nested(map.next_value()?),
7814 "parent_id" => Self::ParentId(map.next_value()?),
7815 "percolate" => Self::Percolate(map.next_value()?),
7816 "pinned" => Self::Pinned(map.next_value()?),
7817 "prefix" => Self::Prefix(map.next_value()?),
7818 "query_string" => Self::QueryString(map.next_value()?),
7819 "range" => Self::Range(map.next_value()?),
7820 "rank_feature" => Self::RankFeature(map.next_value()?),
7821 "regexp" => Self::Regexp(map.next_value()?),
7822 "rule" => Self::Rule(map.next_value()?),
7823 "script" => Self::Script(map.next_value()?),
7824 "script_score" => Self::ScriptScore(map.next_value()?),
7825 "semantic" => Self::Semantic(map.next_value()?),
7826 "shape" => Self::Shape(map.next_value()?),
7827 "simple_query_string" => Self::SimpleQueryString(map.next_value()?),
7828 "span_containing" => Self::SpanContaining(map.next_value()?),
7829 "span_field_masking" => Self::SpanFieldMasking(map.next_value()?),
7830 "span_first" => Self::SpanFirst(map.next_value()?),
7831 "span_multi" => Self::SpanMulti(map.next_value()?),
7832 "span_near" => Self::SpanNear(map.next_value()?),
7833 "span_not" => Self::SpanNot(map.next_value()?),
7834 "span_or" => Self::SpanOr(map.next_value()?),
7835 "span_term" => Self::SpanTerm(map.next_value()?),
7836 "span_within" => Self::SpanWithin(map.next_value()?),
7837 "sparse_vector" => Self::SparseVector(map.next_value()?),
7838 "term" => Self::Term(map.next_value()?),
7839 "terms" => Self::Terms(map.next_value()?),
7840 "terms_set" => Self::TermsSet(map.next_value()?),
7841 "text_expansion" => Self::TextExpansion(map.next_value()?),
7842 "weighted_tokens" => Self::WeightedTokens(map.next_value()?),
7843 "wildcard" => Self::Wildcard(map.next_value()?),
7844 "wrapper" => Self::Wrapper(map.next_value()?),
7845 "type" => Self::Type(map.next_value()?),
7846 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
7847 key,
7848 map.next_value()?,
7849 )),
7850 })
7851 }
7852}
7853
7854impl ::core::convert::From<crate::query_dsl::BoolQuery> for QueryContainer {
7855 fn from(value: crate::query_dsl::BoolQuery) -> Self {
7856 Self::Bool(::std::boxed::Box::new(value))
7857 }
7858}
7859
7860impl ::core::convert::From<crate::query_dsl::BoostingQuery> for QueryContainer {
7861 fn from(value: crate::query_dsl::BoostingQuery) -> Self {
7862 Self::Boosting(::std::boxed::Box::new(value))
7863 }
7864}
7865
7866impl
7867 ::core::convert::From<
7868 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>,
7869 > for QueryContainer
7870{
7871 fn from(
7872 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>,
7873 ) -> Self {
7874 Self::Common(value)
7875 }
7876}
7877
7878impl ::core::convert::From<crate::query_dsl::CombinedFieldsQuery> for QueryContainer {
7879 fn from(value: crate::query_dsl::CombinedFieldsQuery) -> Self {
7880 Self::CombinedFields(value)
7881 }
7882}
7883
7884impl ::core::convert::From<crate::query_dsl::ConstantScoreQuery> for QueryContainer {
7885 fn from(value: crate::query_dsl::ConstantScoreQuery) -> Self {
7886 Self::ConstantScore(::std::boxed::Box::new(value))
7887 }
7888}
7889
7890impl ::core::convert::From<crate::query_dsl::DisMaxQuery> for QueryContainer {
7891 fn from(value: crate::query_dsl::DisMaxQuery) -> Self {
7892 Self::DisMax(value)
7893 }
7894}
7895
7896impl ::core::convert::From<crate::query_dsl::DistanceFeatureQuery> for QueryContainer {
7897 fn from(value: crate::query_dsl::DistanceFeatureQuery) -> Self {
7898 Self::DistanceFeature(value)
7899 }
7900}
7901
7902impl ::core::convert::From<crate::query_dsl::ExistsQuery> for QueryContainer {
7903 fn from(value: crate::query_dsl::ExistsQuery) -> Self {
7904 Self::Exists(value)
7905 }
7906}
7907
7908impl ::core::convert::From<crate::query_dsl::FunctionScoreQuery> for QueryContainer {
7909 fn from(value: crate::query_dsl::FunctionScoreQuery) -> Self {
7910 Self::FunctionScore(::std::boxed::Box::new(value))
7911 }
7912}
7913
7914impl
7915 ::core::convert::From<
7916 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>,
7917 > for QueryContainer
7918{
7919 fn from(
7920 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>,
7921 ) -> Self {
7922 Self::Fuzzy(value)
7923 }
7924}
7925
7926impl ::core::convert::From<crate::query_dsl::GeoBoundingBoxQuery> for QueryContainer {
7927 fn from(value: crate::query_dsl::GeoBoundingBoxQuery) -> Self {
7928 Self::GeoBoundingBox(value)
7929 }
7930}
7931
7932impl ::core::convert::From<crate::query_dsl::GeoDistanceQuery> for QueryContainer {
7933 fn from(value: crate::query_dsl::GeoDistanceQuery) -> Self {
7934 Self::GeoDistance(value)
7935 }
7936}
7937
7938impl
7939 ::core::convert::From<
7940 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>,
7941 > for QueryContainer
7942{
7943 fn from(
7944 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>,
7945 ) -> Self {
7946 Self::GeoGrid(value)
7947 }
7948}
7949
7950impl ::core::convert::From<crate::query_dsl::GeoPolygonQuery> for QueryContainer {
7951 fn from(value: crate::query_dsl::GeoPolygonQuery) -> Self {
7952 Self::GeoPolygon(value)
7953 }
7954}
7955
7956impl ::core::convert::From<crate::query_dsl::GeoShapeQuery> for QueryContainer {
7957 fn from(value: crate::query_dsl::GeoShapeQuery) -> Self {
7958 Self::GeoShape(value)
7959 }
7960}
7961
7962impl ::core::convert::From<crate::query_dsl::HasChildQuery> for QueryContainer {
7963 fn from(value: crate::query_dsl::HasChildQuery) -> Self {
7964 Self::HasChild(::std::boxed::Box::new(value))
7965 }
7966}
7967
7968impl ::core::convert::From<crate::query_dsl::HasParentQuery> for QueryContainer {
7969 fn from(value: crate::query_dsl::HasParentQuery) -> Self {
7970 Self::HasParent(::std::boxed::Box::new(value))
7971 }
7972}
7973
7974impl ::core::convert::From<crate::query_dsl::IdsQuery> for QueryContainer {
7975 fn from(value: crate::query_dsl::IdsQuery) -> Self {
7976 Self::Ids(value)
7977 }
7978}
7979
7980impl
7981 ::core::convert::From<
7982 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>,
7983 > for QueryContainer
7984{
7985 fn from(
7986 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>,
7987 ) -> Self {
7988 Self::Intervals(value)
7989 }
7990}
7991
7992impl ::core::convert::From<crate::KnnQuery> for QueryContainer {
7993 fn from(value: crate::KnnQuery) -> Self {
7994 Self::Knn(::std::boxed::Box::new(value))
7995 }
7996}
7997
7998impl ::core::convert::From<crate::query_dsl::KqlQuery> for QueryContainer {
7999 fn from(value: crate::query_dsl::KqlQuery) -> Self {
8000 Self::Kql(value)
8001 }
8002}
8003
8004impl
8005 ::core::convert::From<
8006 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>,
8007 > for QueryContainer
8008{
8009 fn from(
8010 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>,
8011 ) -> Self {
8012 Self::Match(value)
8013 }
8014}
8015
8016impl ::core::convert::From<crate::query_dsl::MatchAllQuery> for QueryContainer {
8017 fn from(value: crate::query_dsl::MatchAllQuery) -> Self {
8018 Self::MatchAll(value)
8019 }
8020}
8021
8022impl
8023 ::core::convert::From<
8024 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchBoolPrefixQuery>,
8025 > for QueryContainer
8026{
8027 fn from(
8028 value: ::oxsearch_core::shapes::SingleKey<
8029 crate::Field,
8030 crate::query_dsl::MatchBoolPrefixQuery,
8031 >,
8032 ) -> Self {
8033 Self::MatchBoolPrefix(value)
8034 }
8035}
8036
8037impl ::core::convert::From<crate::query_dsl::MatchNoneQuery> for QueryContainer {
8038 fn from(value: crate::query_dsl::MatchNoneQuery) -> Self {
8039 Self::MatchNone(value)
8040 }
8041}
8042
8043impl
8044 ::core::convert::From<
8045 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
8046 > for QueryContainer
8047{
8048 fn from(
8049 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
8050 ) -> Self {
8051 Self::MatchPhrase(value)
8052 }
8053}
8054
8055impl
8056 ::core::convert::From<
8057 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhrasePrefixQuery>,
8058 > for QueryContainer
8059{
8060 fn from(
8061 value: ::oxsearch_core::shapes::SingleKey<
8062 crate::Field,
8063 crate::query_dsl::MatchPhrasePrefixQuery,
8064 >,
8065 ) -> Self {
8066 Self::MatchPhrasePrefix(value)
8067 }
8068}
8069
8070impl ::core::convert::From<crate::query_dsl::MoreLikeThisQuery> for QueryContainer {
8071 fn from(value: crate::query_dsl::MoreLikeThisQuery) -> Self {
8072 Self::MoreLikeThis(value)
8073 }
8074}
8075
8076impl ::core::convert::From<crate::query_dsl::MultiMatchQuery> for QueryContainer {
8077 fn from(value: crate::query_dsl::MultiMatchQuery) -> Self {
8078 Self::MultiMatch(value)
8079 }
8080}
8081
8082impl ::core::convert::From<crate::query_dsl::NestedQuery> for QueryContainer {
8083 fn from(value: crate::query_dsl::NestedQuery) -> Self {
8084 Self::Nested(::std::boxed::Box::new(value))
8085 }
8086}
8087
8088impl ::core::convert::From<crate::query_dsl::ParentIdQuery> for QueryContainer {
8089 fn from(value: crate::query_dsl::ParentIdQuery) -> Self {
8090 Self::ParentId(value)
8091 }
8092}
8093
8094impl ::core::convert::From<crate::query_dsl::PercolateQuery> for QueryContainer {
8095 fn from(value: crate::query_dsl::PercolateQuery) -> Self {
8096 Self::Percolate(value)
8097 }
8098}
8099
8100impl ::core::convert::From<crate::query_dsl::PinnedQuery> for QueryContainer {
8101 fn from(value: crate::query_dsl::PinnedQuery) -> Self {
8102 Self::Pinned(::std::boxed::Box::new(value))
8103 }
8104}
8105
8106impl
8107 ::core::convert::From<
8108 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>,
8109 > for QueryContainer
8110{
8111 fn from(
8112 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>,
8113 ) -> Self {
8114 Self::Prefix(value)
8115 }
8116}
8117
8118impl ::core::convert::From<crate::query_dsl::QueryStringQuery> for QueryContainer {
8119 fn from(value: crate::query_dsl::QueryStringQuery) -> Self {
8120 Self::QueryString(value)
8121 }
8122}
8123
8124impl
8125 ::core::convert::From<
8126 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>,
8127 > for QueryContainer
8128{
8129 fn from(
8130 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>,
8131 ) -> Self {
8132 Self::Range(value)
8133 }
8134}
8135
8136impl ::core::convert::From<crate::query_dsl::RankFeatureQuery> for QueryContainer {
8137 fn from(value: crate::query_dsl::RankFeatureQuery) -> Self {
8138 Self::RankFeature(value)
8139 }
8140}
8141
8142impl
8143 ::core::convert::From<
8144 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>,
8145 > for QueryContainer
8146{
8147 fn from(
8148 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>,
8149 ) -> Self {
8150 Self::Regexp(value)
8151 }
8152}
8153
8154impl ::core::convert::From<crate::query_dsl::RuleQuery> for QueryContainer {
8155 fn from(value: crate::query_dsl::RuleQuery) -> Self {
8156 Self::Rule(::std::boxed::Box::new(value))
8157 }
8158}
8159
8160impl ::core::convert::From<crate::query_dsl::ScriptQuery> for QueryContainer {
8161 fn from(value: crate::query_dsl::ScriptQuery) -> Self {
8162 Self::Script(value)
8163 }
8164}
8165
8166impl ::core::convert::From<crate::query_dsl::ScriptScoreQuery> for QueryContainer {
8167 fn from(value: crate::query_dsl::ScriptScoreQuery) -> Self {
8168 Self::ScriptScore(::std::boxed::Box::new(value))
8169 }
8170}
8171
8172impl ::core::convert::From<crate::query_dsl::SemanticQuery> for QueryContainer {
8173 fn from(value: crate::query_dsl::SemanticQuery) -> Self {
8174 Self::Semantic(value)
8175 }
8176}
8177
8178impl ::core::convert::From<crate::query_dsl::ShapeQuery> for QueryContainer {
8179 fn from(value: crate::query_dsl::ShapeQuery) -> Self {
8180 Self::Shape(value)
8181 }
8182}
8183
8184impl ::core::convert::From<crate::query_dsl::SimpleQueryStringQuery> for QueryContainer {
8185 fn from(value: crate::query_dsl::SimpleQueryStringQuery) -> Self {
8186 Self::SimpleQueryString(value)
8187 }
8188}
8189
8190impl ::core::convert::From<crate::query_dsl::SpanContainingQuery> for QueryContainer {
8191 fn from(value: crate::query_dsl::SpanContainingQuery) -> Self {
8192 Self::SpanContaining(::std::boxed::Box::new(value))
8193 }
8194}
8195
8196impl ::core::convert::From<crate::query_dsl::SpanFieldMaskingQuery> for QueryContainer {
8197 fn from(value: crate::query_dsl::SpanFieldMaskingQuery) -> Self {
8198 Self::SpanFieldMasking(::std::boxed::Box::new(value))
8199 }
8200}
8201
8202impl ::core::convert::From<crate::query_dsl::SpanFirstQuery> for QueryContainer {
8203 fn from(value: crate::query_dsl::SpanFirstQuery) -> Self {
8204 Self::SpanFirst(::std::boxed::Box::new(value))
8205 }
8206}
8207
8208impl ::core::convert::From<crate::query_dsl::SpanMultiTermQuery> for QueryContainer {
8209 fn from(value: crate::query_dsl::SpanMultiTermQuery) -> Self {
8210 Self::SpanMulti(::std::boxed::Box::new(value))
8211 }
8212}
8213
8214impl ::core::convert::From<crate::query_dsl::SpanNearQuery> for QueryContainer {
8215 fn from(value: crate::query_dsl::SpanNearQuery) -> Self {
8216 Self::SpanNear(value)
8217 }
8218}
8219
8220impl ::core::convert::From<crate::query_dsl::SpanNotQuery> for QueryContainer {
8221 fn from(value: crate::query_dsl::SpanNotQuery) -> Self {
8222 Self::SpanNot(::std::boxed::Box::new(value))
8223 }
8224}
8225
8226impl ::core::convert::From<crate::query_dsl::SpanOrQuery> for QueryContainer {
8227 fn from(value: crate::query_dsl::SpanOrQuery) -> Self {
8228 Self::SpanOr(value)
8229 }
8230}
8231
8232impl
8233 ::core::convert::From<
8234 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
8235 > for QueryContainer
8236{
8237 fn from(
8238 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
8239 ) -> Self {
8240 Self::SpanTerm(value)
8241 }
8242}
8243
8244impl ::core::convert::From<crate::query_dsl::SpanWithinQuery> for QueryContainer {
8245 fn from(value: crate::query_dsl::SpanWithinQuery) -> Self {
8246 Self::SpanWithin(::std::boxed::Box::new(value))
8247 }
8248}
8249
8250impl ::core::convert::From<crate::query_dsl::SparseVectorQuery> for QueryContainer {
8251 fn from(value: crate::query_dsl::SparseVectorQuery) -> Self {
8252 Self::SparseVector(value)
8253 }
8254}
8255
8256impl
8257 ::core::convert::From<
8258 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>,
8259 > for QueryContainer
8260{
8261 fn from(
8262 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>,
8263 ) -> Self {
8264 Self::Term(value)
8265 }
8266}
8267
8268impl ::core::convert::From<crate::query_dsl::TermsQuery> for QueryContainer {
8269 fn from(value: crate::query_dsl::TermsQuery) -> Self {
8270 Self::Terms(value)
8271 }
8272}
8273
8274impl
8275 ::core::convert::From<
8276 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>,
8277 > for QueryContainer
8278{
8279 fn from(
8280 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>,
8281 ) -> Self {
8282 Self::TermsSet(value)
8283 }
8284}
8285
8286impl
8287 ::core::convert::From<
8288 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TextExpansionQuery>,
8289 > for QueryContainer
8290{
8291 fn from(
8292 value: ::oxsearch_core::shapes::SingleKey<
8293 crate::Field,
8294 crate::query_dsl::TextExpansionQuery,
8295 >,
8296 ) -> Self {
8297 Self::TextExpansion(value)
8298 }
8299}
8300
8301impl
8302 ::core::convert::From<
8303 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WeightedTokensQuery>,
8304 > for QueryContainer
8305{
8306 fn from(
8307 value: ::oxsearch_core::shapes::SingleKey<
8308 crate::Field,
8309 crate::query_dsl::WeightedTokensQuery,
8310 >,
8311 ) -> Self {
8312 Self::WeightedTokens(value)
8313 }
8314}
8315
8316impl
8317 ::core::convert::From<
8318 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>,
8319 > for QueryContainer
8320{
8321 fn from(
8322 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>,
8323 ) -> Self {
8324 Self::Wildcard(value)
8325 }
8326}
8327
8328impl ::core::convert::From<crate::query_dsl::WrapperQuery> for QueryContainer {
8329 fn from(value: crate::query_dsl::WrapperQuery) -> Self {
8330 Self::Wrapper(value)
8331 }
8332}
8333
8334impl ::core::convert::From<crate::query_dsl::TypeQuery> for QueryContainer {
8335 fn from(value: crate::query_dsl::TypeQuery) -> Self {
8336 Self::Type(value)
8337 }
8338}
8339
8340#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8341#[non_exhaustive]
8342pub struct QueryStringQuery {
8343 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8348 pub boost: ::core::option::Option<f32>,
8349 #[serde(
8350 rename = "_name",
8351 skip_serializing_if = "::core::option::Option::is_none"
8352 )]
8353 pub name: ::core::option::Option<::std::string::String>,
8354 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8356 pub allow_leading_wildcard: ::core::option::Option<bool>,
8357 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8359 pub analyzer: ::core::option::Option<::std::string::String>,
8360 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8362 pub analyze_wildcard: ::core::option::Option<bool>,
8363 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8365 pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
8366 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8370 pub default_field: ::core::option::Option<crate::Field>,
8371 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8373 pub default_operator: ::core::option::Option<crate::query_dsl::Operator>,
8374 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8376 pub enable_position_increments: ::core::option::Option<bool>,
8377 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8378 pub escape: ::core::option::Option<bool>,
8379 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8381 pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
8382 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8384 pub fuzziness: ::core::option::Option<crate::Fuzziness>,
8385 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8387 pub fuzzy_max_expansions: ::core::option::Option<i32>,
8388 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8390 pub fuzzy_prefix_length: ::core::option::Option<i32>,
8391 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8393 pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
8394 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8396 pub fuzzy_transpositions: ::core::option::Option<bool>,
8397 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8399 pub lenient: ::core::option::Option<bool>,
8400 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8402 pub max_determinized_states: ::core::option::Option<i32>,
8403 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8405 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
8406 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8408 pub phrase_slop: ::core::option::Option<f64>,
8409 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8411 pub query: ::core::option::Option<::std::string::String>,
8412 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8415 pub quote_analyzer: ::core::option::Option<::std::string::String>,
8416 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8419 pub quote_field_suffix: ::core::option::Option<::std::string::String>,
8420 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8422 pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
8423 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8425 pub tie_breaker: ::core::option::Option<f64>,
8426 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8428 pub time_zone: ::core::option::Option<crate::TimeZone>,
8429 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8431 pub r#type: ::core::option::Option<crate::query_dsl::TextQueryType>,
8432}
8433
8434impl QueryStringQuery {
8435 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
8437 Self {
8438 boost: ::core::option::Option::None,
8439 name: ::core::option::Option::None,
8440 allow_leading_wildcard: ::core::option::Option::None,
8441 analyzer: ::core::option::Option::None,
8442 analyze_wildcard: ::core::option::Option::None,
8443 auto_generate_synonyms_phrase_query: ::core::option::Option::None,
8444 default_field: ::core::option::Option::None,
8445 default_operator: ::core::option::Option::None,
8446 enable_position_increments: ::core::option::Option::None,
8447 escape: ::core::option::Option::None,
8448 fields: ::core::option::Option::None,
8449 fuzziness: ::core::option::Option::None,
8450 fuzzy_max_expansions: ::core::option::Option::None,
8451 fuzzy_prefix_length: ::core::option::Option::None,
8452 fuzzy_rewrite: ::core::option::Option::None,
8453 fuzzy_transpositions: ::core::option::Option::None,
8454 lenient: ::core::option::Option::None,
8455 max_determinized_states: ::core::option::Option::None,
8456 minimum_should_match: ::core::option::Option::None,
8457 phrase_slop: ::core::option::Option::None,
8458 query: ::core::option::Option::Some(query.into()),
8459 quote_analyzer: ::core::option::Option::None,
8460 quote_field_suffix: ::core::option::Option::None,
8461 rewrite: ::core::option::Option::None,
8462 tie_breaker: ::core::option::Option::None,
8463 time_zone: ::core::option::Option::None,
8464 r#type: ::core::option::Option::None,
8465 }
8466 }
8467}
8468
8469impl QueryStringQuery {
8470 pub fn boost(mut self, value: f32) -> Self {
8472 self.boost = ::core::option::Option::Some(value.into());
8473 self
8474 }
8475 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8477 self.name = ::core::option::Option::Some(value.into());
8478 self
8479 }
8480 pub fn allow_leading_wildcard(mut self, value: bool) -> Self {
8482 self.allow_leading_wildcard = ::core::option::Option::Some(value.into());
8483 self
8484 }
8485 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8487 self.analyzer = ::core::option::Option::Some(value.into());
8488 self
8489 }
8490 pub fn analyze_wildcard(mut self, value: bool) -> Self {
8492 self.analyze_wildcard = ::core::option::Option::Some(value.into());
8493 self
8494 }
8495 pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
8497 self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
8498 self
8499 }
8500 pub fn default_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
8502 self.default_field = ::core::option::Option::Some(value.into());
8503 self
8504 }
8505 pub fn default_operator(
8507 mut self,
8508 value: impl ::core::convert::Into<crate::query_dsl::Operator>,
8509 ) -> Self {
8510 self.default_operator = ::core::option::Option::Some(value.into());
8511 self
8512 }
8513 pub fn enable_position_increments(mut self, value: bool) -> Self {
8515 self.enable_position_increments = ::core::option::Option::Some(value.into());
8516 self
8517 }
8518 pub fn escape(mut self, value: bool) -> Self {
8520 self.escape = ::core::option::Option::Some(value.into());
8521 self
8522 }
8523 pub fn fields(
8525 mut self,
8526 value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
8527 ) -> Self {
8528 self.fields = ::core::option::Option::Some(value.into());
8529 self
8530 }
8531 pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
8533 self.fuzziness = ::core::option::Option::Some(value.into());
8534 self
8535 }
8536 pub fn fuzzy_max_expansions(mut self, value: i32) -> Self {
8538 self.fuzzy_max_expansions = ::core::option::Option::Some(value.into());
8539 self
8540 }
8541 pub fn fuzzy_prefix_length(mut self, value: i32) -> Self {
8543 self.fuzzy_prefix_length = ::core::option::Option::Some(value.into());
8544 self
8545 }
8546 pub fn fuzzy_rewrite(
8548 mut self,
8549 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
8550 ) -> Self {
8551 self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
8552 self
8553 }
8554 pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
8556 self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
8557 self
8558 }
8559 pub fn lenient(mut self, value: bool) -> Self {
8561 self.lenient = ::core::option::Option::Some(value.into());
8562 self
8563 }
8564 pub fn max_determinized_states(mut self, value: i32) -> Self {
8566 self.max_determinized_states = ::core::option::Option::Some(value.into());
8567 self
8568 }
8569 pub fn minimum_should_match(
8571 mut self,
8572 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
8573 ) -> Self {
8574 self.minimum_should_match = ::core::option::Option::Some(value.into());
8575 self
8576 }
8577 pub fn phrase_slop(mut self, value: f64) -> Self {
8579 self.phrase_slop = ::core::option::Option::Some(value.into());
8580 self
8581 }
8582 pub fn quote_analyzer(
8584 mut self,
8585 value: impl ::core::convert::Into<::std::string::String>,
8586 ) -> Self {
8587 self.quote_analyzer = ::core::option::Option::Some(value.into());
8588 self
8589 }
8590 pub fn quote_field_suffix(
8592 mut self,
8593 value: impl ::core::convert::Into<::std::string::String>,
8594 ) -> Self {
8595 self.quote_field_suffix = ::core::option::Option::Some(value.into());
8596 self
8597 }
8598 pub fn rewrite(
8600 mut self,
8601 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
8602 ) -> Self {
8603 self.rewrite = ::core::option::Option::Some(value.into());
8604 self
8605 }
8606 pub fn tie_breaker(mut self, value: f64) -> Self {
8608 self.tie_breaker = ::core::option::Option::Some(value.into());
8609 self
8610 }
8611 pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
8613 self.time_zone = ::core::option::Option::Some(value.into());
8614 self
8615 }
8616 pub fn r#type(
8618 mut self,
8619 value: impl ::core::convert::Into<crate::query_dsl::TextQueryType>,
8620 ) -> Self {
8621 self.r#type = ::core::option::Option::Some(value.into());
8622 self
8623 }
8624}
8625
8626#[derive(Clone, Debug, PartialEq)]
8627#[non_exhaustive]
8628pub enum RandomScoreFunctionSeed {
8629 Long(i64),
8631 String(::std::string::String),
8633}
8634
8635impl ::serde::Serialize for RandomScoreFunctionSeed {
8636 fn serialize<S__: ::serde::Serializer>(
8637 &self,
8638 serializer: S__,
8639 ) -> ::core::result::Result<S__::Ok, S__::Error> {
8640 match self {
8641 Self::Long(value) => ::serde::Serialize::serialize(value, serializer),
8642 Self::String(value) => ::serde::Serialize::serialize(value, serializer),
8643 }
8644 }
8645}
8646
8647impl<'de> ::serde::Deserialize<'de> for RandomScoreFunctionSeed {
8648 fn deserialize<D__: ::serde::Deserializer<'de>>(
8649 deserializer: D__,
8650 ) -> ::core::result::Result<Self, D__::Error> {
8651 struct Shape;
8652 impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
8653 type Value = RandomScoreFunctionSeed;
8654 const EXPECTING: &'static str = "RandomScoreFunctionSeed: number or string";
8655 fn visit<V__: ::serde::Deserializer<'de>>(
8656 self,
8657 kind: ::oxsearch_core::__private::Kind,
8658 value: V__,
8659 ) -> ::core::result::Result<Self::Value, V__::Error> {
8660 match kind {
8661 ::oxsearch_core::__private::Kind::Number => {
8662 <i64 as ::serde::Deserialize>::deserialize(value)
8663 .map(RandomScoreFunctionSeed::Long)
8664 }
8665 ::oxsearch_core::__private::Kind::String => {
8666 <::std::string::String as ::serde::Deserialize>::deserialize(value)
8667 .map(RandomScoreFunctionSeed::String)
8668 }
8669 _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
8670 format_args!("RandomScoreFunctionSeed can't be {kind:?}"),
8671 )),
8672 }
8673 }
8674 }
8675 ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
8676 }
8677}
8678
8679impl ::core::convert::From<i64> for RandomScoreFunctionSeed {
8680 fn from(value: i64) -> Self {
8681 Self::Long(value)
8682 }
8683}
8684
8685impl ::core::convert::From<::std::string::String> for RandomScoreFunctionSeed {
8686 fn from(value: ::std::string::String) -> Self {
8687 Self::String(value)
8688 }
8689}
8690
8691impl ::core::convert::From<&str> for RandomScoreFunctionSeed {
8692 fn from(value: &str) -> Self {
8693 Self::String(::std::borrow::ToOwned::to_owned(value))
8694 }
8695}
8696
8697#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8698#[non_exhaustive]
8699pub struct RandomScoreFunction {
8700 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8701 pub field: ::core::option::Option<crate::Field>,
8702 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8703 pub seed: ::core::option::Option<crate::query_dsl::RandomScoreFunctionSeed>,
8704}
8705
8706impl RandomScoreFunction {
8707 pub fn new() -> Self {
8709 Self {
8710 field: ::core::option::Option::None,
8711 seed: ::core::option::Option::None,
8712 }
8713 }
8714}
8715
8716impl RandomScoreFunction {
8717 pub fn field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
8719 self.field = ::core::option::Option::Some(value.into());
8720 self
8721 }
8722 pub fn seed(
8724 mut self,
8725 value: impl ::core::convert::Into<crate::query_dsl::RandomScoreFunctionSeed>,
8726 ) -> Self {
8727 self.seed = ::core::option::Option::Some(value.into());
8728 self
8729 }
8730}
8731
8732#[derive(Clone, Debug, PartialEq)]
8733#[non_exhaustive]
8734pub enum RangeQuery {
8735 Untyped(crate::query_dsl::UntypedRangeQuery),
8737 Date(crate::query_dsl::DateRangeQuery),
8739 Number(crate::query_dsl::NumberRangeQuery),
8741 LongNumber(crate::query_dsl::LongNumberRangeQuery),
8743 Term(crate::query_dsl::TermRangeQuery),
8745}
8746
8747impl ::serde::Serialize for RangeQuery {
8748 fn serialize<S__: ::serde::Serializer>(
8749 &self,
8750 serializer: S__,
8751 ) -> ::core::result::Result<S__::Ok, S__::Error> {
8752 match self {
8753 Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
8754 Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
8755 Self::Number(value) => ::serde::Serialize::serialize(value, serializer),
8756 Self::LongNumber(value) => ::serde::Serialize::serialize(value, serializer),
8757 Self::Term(value) => ::serde::Serialize::serialize(value, serializer),
8758 }
8759 }
8760}
8761
8762impl<'de> ::serde::Deserialize<'de> for RangeQuery {
8763 fn deserialize<D__: ::serde::Deserializer<'de>>(
8765 deserializer: D__,
8766 ) -> ::core::result::Result<Self, D__::Error> {
8767 ::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
8768 }
8769}
8770
8771impl ::core::convert::From<crate::query_dsl::UntypedRangeQuery> for RangeQuery {
8772 fn from(value: crate::query_dsl::UntypedRangeQuery) -> Self {
8773 Self::Untyped(value)
8774 }
8775}
8776
8777impl ::core::convert::From<crate::query_dsl::DateRangeQuery> for RangeQuery {
8778 fn from(value: crate::query_dsl::DateRangeQuery) -> Self {
8779 Self::Date(value)
8780 }
8781}
8782
8783impl ::core::convert::From<crate::query_dsl::NumberRangeQuery> for RangeQuery {
8784 fn from(value: crate::query_dsl::NumberRangeQuery) -> Self {
8785 Self::Number(value)
8786 }
8787}
8788
8789impl ::core::convert::From<crate::query_dsl::LongNumberRangeQuery> for RangeQuery {
8790 fn from(value: crate::query_dsl::LongNumberRangeQuery) -> Self {
8791 Self::LongNumber(value)
8792 }
8793}
8794
8795impl ::core::convert::From<crate::query_dsl::TermRangeQuery> for RangeQuery {
8796 fn from(value: crate::query_dsl::TermRangeQuery) -> Self {
8797 Self::Term(value)
8798 }
8799}
8800
8801#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8802#[non_exhaustive]
8803pub struct RangeQueryBase<T = ::serde_json::Value> {
8804 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8809 pub boost: ::core::option::Option<f32>,
8810 #[serde(
8811 rename = "_name",
8812 skip_serializing_if = "::core::option::Option::is_none"
8813 )]
8814 pub name: ::core::option::Option<::std::string::String>,
8815 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8817 pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
8818 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8820 pub gt: ::core::option::Option<T>,
8821 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8823 pub gte: ::core::option::Option<T>,
8824 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8826 pub lt: ::core::option::Option<T>,
8827 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8829 pub lte: ::core::option::Option<T>,
8830}
8831
8832impl RangeQueryBase<::serde_json::Value> {
8833 pub fn new() -> Self {
8835 Self {
8836 boost: ::core::option::Option::None,
8837 name: ::core::option::Option::None,
8838 relation: ::core::option::Option::None,
8839 gt: ::core::option::Option::None,
8840 gte: ::core::option::Option::None,
8841 lt: ::core::option::Option::None,
8842 lte: ::core::option::Option::None,
8843 }
8844 }
8845}
8846
8847impl<T> RangeQueryBase<T> {
8848 pub fn boost(mut self, value: f32) -> Self {
8850 self.boost = ::core::option::Option::Some(value.into());
8851 self
8852 }
8853 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8855 self.name = ::core::option::Option::Some(value.into());
8856 self
8857 }
8858 pub fn relation(
8860 mut self,
8861 value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
8862 ) -> Self {
8863 self.relation = ::core::option::Option::Some(value.into());
8864 self
8865 }
8866 pub fn gt(mut self, value: T) -> Self {
8868 self.gt = ::core::option::Option::Some(value.into());
8869 self
8870 }
8871 pub fn gte(mut self, value: T) -> Self {
8873 self.gte = ::core::option::Option::Some(value.into());
8874 self
8875 }
8876 pub fn lt(mut self, value: T) -> Self {
8878 self.lt = ::core::option::Option::Some(value.into());
8879 self
8880 }
8881 pub fn lte(mut self, value: T) -> Self {
8883 self.lte = ::core::option::Option::Some(value.into());
8884 self
8885 }
8886}
8887
8888#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8889#[non_exhaustive]
8890pub enum RangeRelation {
8891 Within,
8893 Contains,
8895 Intersects,
8897 Raw(::std::string::String),
8899}
8900
8901impl RangeRelation {
8902 pub fn as_str(&self) -> &str {
8904 match self {
8905 Self::Within => "within",
8906 Self::Contains => "contains",
8907 Self::Intersects => "intersects",
8908 Self::Raw(value) => value,
8909 }
8910 }
8911
8912 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
8914 match value {
8915 "within" => ::core::option::Option::Some(Self::Within),
8916 "contains" => ::core::option::Option::Some(Self::Contains),
8917 "intersects" => ::core::option::Option::Some(Self::Intersects),
8918 _ => ::core::option::Option::None,
8919 }
8920 }
8921}
8922
8923impl ::serde::Serialize for RangeRelation {
8924 fn serialize<S__: ::serde::Serializer>(
8925 &self,
8926 serializer: S__,
8927 ) -> ::core::result::Result<S__::Ok, S__::Error> {
8928 serializer.serialize_str(self.as_str())
8929 }
8930}
8931
8932impl<'de> ::serde::Deserialize<'de> for RangeRelation {
8933 fn deserialize<D__: ::serde::Deserializer<'de>>(
8934 deserializer: D__,
8935 ) -> ::core::result::Result<Self, D__::Error> {
8936 ::oxsearch_core::__private::deserialize_string_enum(
8937 deserializer,
8938 "RangeRelation",
8939 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
8940 )
8941 }
8942}
8943
8944#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8945#[non_exhaustive]
8946pub struct RankFeatureFunction {}
8947
8948impl RankFeatureFunction {
8949 pub fn new() -> Self {
8951 Self {}
8952 }
8953}
8954
8955impl RankFeatureFunction {}
8956
8957#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8958#[non_exhaustive]
8959pub struct RankFeatureFunctionLinear {}
8960
8961impl RankFeatureFunctionLinear {
8962 pub fn new() -> Self {
8964 Self {}
8965 }
8966}
8967
8968impl RankFeatureFunctionLinear {}
8969
8970#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8971#[non_exhaustive]
8972pub struct RankFeatureFunctionLogarithm {
8973 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8975 pub scaling_factor: ::core::option::Option<f32>,
8976}
8977
8978impl RankFeatureFunctionLogarithm {
8979 pub fn new(scaling_factor: f32) -> Self {
8981 Self {
8982 scaling_factor: ::core::option::Option::Some(scaling_factor.into()),
8983 }
8984 }
8985}
8986
8987impl RankFeatureFunctionLogarithm {}
8988
8989#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8990#[non_exhaustive]
8991pub struct RankFeatureFunctionSaturation {
8992 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8994 pub pivot: ::core::option::Option<f32>,
8995}
8996
8997impl RankFeatureFunctionSaturation {
8998 pub fn new() -> Self {
9000 Self {
9001 pivot: ::core::option::Option::None,
9002 }
9003 }
9004}
9005
9006impl RankFeatureFunctionSaturation {
9007 pub fn pivot(mut self, value: f32) -> Self {
9009 self.pivot = ::core::option::Option::Some(value.into());
9010 self
9011 }
9012}
9013
9014#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9015#[non_exhaustive]
9016pub struct RankFeatureFunctionSigmoid {
9017 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9019 pub pivot: ::core::option::Option<f32>,
9020 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9022 pub exponent: ::core::option::Option<f32>,
9023}
9024
9025impl RankFeatureFunctionSigmoid {
9026 pub fn new(pivot: f32, exponent: f32) -> Self {
9028 Self {
9029 pivot: ::core::option::Option::Some(pivot.into()),
9030 exponent: ::core::option::Option::Some(exponent.into()),
9031 }
9032 }
9033}
9034
9035impl RankFeatureFunctionSigmoid {}
9036
9037#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9038#[non_exhaustive]
9039pub struct RankFeatureQuery {
9040 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9045 pub boost: ::core::option::Option<f32>,
9046 #[serde(
9047 rename = "_name",
9048 skip_serializing_if = "::core::option::Option::is_none"
9049 )]
9050 pub name: ::core::option::Option<::std::string::String>,
9051 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9053 pub field: ::core::option::Option<crate::Field>,
9054 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9056 pub saturation: ::core::option::Option<crate::query_dsl::RankFeatureFunctionSaturation>,
9057 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9059 pub log: ::core::option::Option<crate::query_dsl::RankFeatureFunctionLogarithm>,
9060 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9062 pub linear: ::core::option::Option<crate::query_dsl::RankFeatureFunctionLinear>,
9063 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9065 pub sigmoid: ::core::option::Option<crate::query_dsl::RankFeatureFunctionSigmoid>,
9066}
9067
9068impl RankFeatureQuery {
9069 pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
9071 Self {
9072 boost: ::core::option::Option::None,
9073 name: ::core::option::Option::None,
9074 field: ::core::option::Option::Some(field.into()),
9075 saturation: ::core::option::Option::None,
9076 log: ::core::option::Option::None,
9077 linear: ::core::option::Option::None,
9078 sigmoid: ::core::option::Option::None,
9079 }
9080 }
9081}
9082
9083impl RankFeatureQuery {
9084 pub fn boost(mut self, value: f32) -> Self {
9086 self.boost = ::core::option::Option::Some(value.into());
9087 self
9088 }
9089 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9091 self.name = ::core::option::Option::Some(value.into());
9092 self
9093 }
9094 pub fn saturation(
9096 mut self,
9097 value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionSaturation>,
9098 ) -> Self {
9099 self.saturation = ::core::option::Option::Some(value.into());
9100 self
9101 }
9102 pub fn log(
9104 mut self,
9105 value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionLogarithm>,
9106 ) -> Self {
9107 self.log = ::core::option::Option::Some(value.into());
9108 self
9109 }
9110 pub fn linear(
9112 mut self,
9113 value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionLinear>,
9114 ) -> Self {
9115 self.linear = ::core::option::Option::Some(value.into());
9116 self
9117 }
9118 pub fn sigmoid(
9120 mut self,
9121 value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionSigmoid>,
9122 ) -> Self {
9123 self.sigmoid = ::core::option::Option::Some(value.into());
9124 self
9125 }
9126}
9127
9128#[derive(Clone, Debug, PartialEq)]
9129#[non_exhaustive]
9130pub struct RegexpQuery {
9131 pub boost: ::core::option::Option<f32>,
9136 pub name: ::core::option::Option<::std::string::String>,
9137 pub case_insensitive: ::core::option::Option<bool>,
9140 pub flags: ::core::option::Option<::std::string::String>,
9142 pub max_determinized_states: ::core::option::Option<i32>,
9144 pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
9146 pub value: ::core::option::Option<::std::string::String>,
9148}
9149
9150impl RegexpQuery {
9151 pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
9153 Self {
9154 boost: ::core::option::Option::None,
9155 name: ::core::option::Option::None,
9156 case_insensitive: ::core::option::Option::None,
9157 flags: ::core::option::Option::None,
9158 max_determinized_states: ::core::option::Option::None,
9159 rewrite: ::core::option::Option::None,
9160 value: ::core::option::Option::Some(value.into()),
9161 }
9162 }
9163}
9164
9165impl RegexpQuery {
9166 pub fn boost(mut self, value: f32) -> Self {
9168 self.boost = ::core::option::Option::Some(value.into());
9169 self
9170 }
9171 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9173 self.name = ::core::option::Option::Some(value.into());
9174 self
9175 }
9176 pub fn case_insensitive(mut self, value: bool) -> Self {
9178 self.case_insensitive = ::core::option::Option::Some(value.into());
9179 self
9180 }
9181 pub fn flags(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9183 self.flags = ::core::option::Option::Some(value.into());
9184 self
9185 }
9186 pub fn max_determinized_states(mut self, value: i32) -> Self {
9188 self.max_determinized_states = ::core::option::Option::Some(value.into());
9189 self
9190 }
9191 pub fn rewrite(
9193 mut self,
9194 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
9195 ) -> Self {
9196 self.rewrite = ::core::option::Option::Some(value.into());
9197 self
9198 }
9199}
9200
9201#[derive(::serde::Serialize, ::serde::Deserialize)]
9202#[serde(remote = "RegexpQuery")]
9203struct RegexpQueryDef {
9204 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9209 boost: ::core::option::Option<f32>,
9210 #[serde(
9211 rename = "_name",
9212 skip_serializing_if = "::core::option::Option::is_none"
9213 )]
9214 name: ::core::option::Option<::std::string::String>,
9215 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9218 case_insensitive: ::core::option::Option<bool>,
9219 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9221 flags: ::core::option::Option<::std::string::String>,
9222 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9224 max_determinized_states: ::core::option::Option<i32>,
9225 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9227 rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
9228 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9230 value: ::core::option::Option<::std::string::String>,
9231}
9232
9233impl ::serde::Serialize for RegexpQuery {
9234 fn serialize<S__: ::serde::Serializer>(
9235 &self,
9236 serializer: S__,
9237 ) -> ::core::result::Result<S__::Ok, S__::Error> {
9238 if let (::core::option::Option::Some(short), true) = (
9239 &self.value,
9240 self.boost.is_none()
9241 && self.name.is_none()
9242 && self.case_insensitive.is_none()
9243 && self.flags.is_none()
9244 && self.max_determinized_states.is_none()
9245 && self.rewrite.is_none(),
9246 ) {
9247 return ::serde::Serialize::serialize(short, serializer);
9248 }
9249 RegexpQueryDef::serialize(self, serializer)
9250 }
9251}
9252
9253impl<'de> ::oxsearch_core::__private::Shorthand<'de> for RegexpQuery {
9254 type Short = ::std::string::String;
9255 fn from_short(short: ::std::string::String) -> Self {
9256 Self {
9257 boost: ::core::option::Option::None,
9258 name: ::core::option::Option::None,
9259 case_insensitive: ::core::option::Option::None,
9260 flags: ::core::option::Option::None,
9261 max_determinized_states: ::core::option::Option::None,
9262 rewrite: ::core::option::Option::None,
9263 value: ::core::option::Option::Some(short),
9264 }
9265 }
9266 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
9267 deserializer: D__,
9268 ) -> ::core::result::Result<Self, D__::Error> {
9269 RegexpQueryDef::deserialize(deserializer)
9270 }
9271}
9272
9273impl<'de> ::serde::Deserialize<'de> for RegexpQuery {
9274 fn deserialize<D__: ::serde::Deserializer<'de>>(
9275 deserializer: D__,
9276 ) -> ::core::result::Result<Self, D__::Error> {
9277 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
9278 }
9279}
9280
9281#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9282#[non_exhaustive]
9283pub struct RuleQuery {
9284 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9289 pub boost: ::core::option::Option<f32>,
9290 #[serde(
9291 rename = "_name",
9292 skip_serializing_if = "::core::option::Option::is_none"
9293 )]
9294 pub name: ::core::option::Option<::std::string::String>,
9295 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9296 pub organic: ::core::option::Option<crate::query_dsl::QueryContainer>,
9297 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9298 pub ruleset_ids: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
9299 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9300 pub ruleset_id: ::core::option::Option<::std::string::String>,
9301 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9302 pub match_criteria: ::core::option::Option<::serde_json::Value>,
9303}
9304
9305impl RuleQuery {
9306 pub fn new(
9308 organic: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
9309 match_criteria: impl ::core::convert::Into<::serde_json::Value>,
9310 ) -> Self {
9311 Self {
9312 boost: ::core::option::Option::None,
9313 name: ::core::option::Option::None,
9314 organic: ::core::option::Option::Some(organic.into()),
9315 ruleset_ids: ::core::option::Option::None,
9316 ruleset_id: ::core::option::Option::None,
9317 match_criteria: ::core::option::Option::Some(match_criteria.into()),
9318 }
9319 }
9320}
9321
9322impl RuleQuery {
9323 pub fn boost(mut self, value: f32) -> Self {
9325 self.boost = ::core::option::Option::Some(value.into());
9326 self
9327 }
9328 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9330 self.name = ::core::option::Option::Some(value.into());
9331 self
9332 }
9333 pub fn ruleset_ids(
9335 mut self,
9336 value: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
9337 ) -> Self {
9338 self.ruleset_ids = ::core::option::Option::Some(value.into());
9339 self
9340 }
9341 pub fn ruleset_id(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9343 self.ruleset_id = ::core::option::Option::Some(value.into());
9344 self
9345 }
9346}
9347
9348#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9349#[non_exhaustive]
9350pub struct ScriptQuery {
9351 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9356 pub boost: ::core::option::Option<f32>,
9357 #[serde(
9358 rename = "_name",
9359 skip_serializing_if = "::core::option::Option::is_none"
9360 )]
9361 pub name: ::core::option::Option<::std::string::String>,
9362 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9365 pub script: ::core::option::Option<crate::Script>,
9366}
9367
9368impl ScriptQuery {
9369 pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
9371 Self {
9372 boost: ::core::option::Option::None,
9373 name: ::core::option::Option::None,
9374 script: ::core::option::Option::Some(script.into()),
9375 }
9376 }
9377}
9378
9379impl ScriptQuery {
9380 pub fn boost(mut self, value: f32) -> Self {
9382 self.boost = ::core::option::Option::Some(value.into());
9383 self
9384 }
9385 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9387 self.name = ::core::option::Option::Some(value.into());
9388 self
9389 }
9390}
9391
9392#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9393#[non_exhaustive]
9394pub struct ScriptScoreFunction {
9395 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9397 pub script: ::core::option::Option<crate::Script>,
9398}
9399
9400impl ScriptScoreFunction {
9401 pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
9403 Self {
9404 script: ::core::option::Option::Some(script.into()),
9405 }
9406 }
9407}
9408
9409impl ScriptScoreFunction {}
9410
9411#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9412#[non_exhaustive]
9413pub struct ScriptScoreQuery {
9414 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9419 pub boost: ::core::option::Option<f32>,
9420 #[serde(
9421 rename = "_name",
9422 skip_serializing_if = "::core::option::Option::is_none"
9423 )]
9424 pub name: ::core::option::Option<::std::string::String>,
9425 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9427 pub min_score: ::core::option::Option<f32>,
9428 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9430 pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
9431 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9434 pub script: ::core::option::Option<crate::Script>,
9435}
9436
9437impl ScriptScoreQuery {
9438 pub fn new(
9440 query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
9441 script: impl ::core::convert::Into<crate::Script>,
9442 ) -> Self {
9443 Self {
9444 boost: ::core::option::Option::None,
9445 name: ::core::option::Option::None,
9446 min_score: ::core::option::Option::None,
9447 query: ::core::option::Option::Some(query.into()),
9448 script: ::core::option::Option::Some(script.into()),
9449 }
9450 }
9451}
9452
9453impl ScriptScoreQuery {
9454 pub fn boost(mut self, value: f32) -> Self {
9456 self.boost = ::core::option::Option::Some(value.into());
9457 self
9458 }
9459 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9461 self.name = ::core::option::Option::Some(value.into());
9462 self
9463 }
9464 pub fn min_score(mut self, value: f32) -> Self {
9466 self.min_score = ::core::option::Option::Some(value.into());
9467 self
9468 }
9469}
9470
9471#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9472#[non_exhaustive]
9473pub struct SemanticQuery {
9474 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9479 pub boost: ::core::option::Option<f32>,
9480 #[serde(
9481 rename = "_name",
9482 skip_serializing_if = "::core::option::Option::is_none"
9483 )]
9484 pub name: ::core::option::Option<::std::string::String>,
9485 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9487 pub field: ::core::option::Option<::std::string::String>,
9488 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9490 pub query: ::core::option::Option<::std::string::String>,
9491}
9492
9493impl SemanticQuery {
9494 pub fn new(
9496 field: impl ::core::convert::Into<::std::string::String>,
9497 query: impl ::core::convert::Into<::std::string::String>,
9498 ) -> Self {
9499 Self {
9500 boost: ::core::option::Option::None,
9501 name: ::core::option::Option::None,
9502 field: ::core::option::Option::Some(field.into()),
9503 query: ::core::option::Option::Some(query.into()),
9504 }
9505 }
9506}
9507
9508impl SemanticQuery {
9509 pub fn boost(mut self, value: f32) -> Self {
9511 self.boost = ::core::option::Option::Some(value.into());
9512 self
9513 }
9514 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9516 self.name = ::core::option::Option::Some(value.into());
9517 self
9518 }
9519}
9520
9521#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9522#[non_exhaustive]
9523pub struct ShapeFieldQuery {
9524 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9526 pub indexed_shape: ::core::option::Option<crate::query_dsl::FieldLookup>,
9527 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9529 pub relation: ::core::option::Option<crate::GeoShapeRelation>,
9530 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9532 pub shape: ::core::option::Option<crate::GeoShape>,
9533}
9534
9535impl ShapeFieldQuery {
9536 pub fn new() -> Self {
9538 Self {
9539 indexed_shape: ::core::option::Option::None,
9540 relation: ::core::option::Option::None,
9541 shape: ::core::option::Option::None,
9542 }
9543 }
9544}
9545
9546impl ShapeFieldQuery {
9547 pub fn indexed_shape(
9549 mut self,
9550 value: impl ::core::convert::Into<crate::query_dsl::FieldLookup>,
9551 ) -> Self {
9552 self.indexed_shape = ::core::option::Option::Some(value.into());
9553 self
9554 }
9555 pub fn relation(mut self, value: impl ::core::convert::Into<crate::GeoShapeRelation>) -> Self {
9557 self.relation = ::core::option::Option::Some(value.into());
9558 self
9559 }
9560 pub fn shape(mut self, value: impl ::core::convert::Into<crate::GeoShape>) -> Self {
9562 self.shape = ::core::option::Option::Some(value.into());
9563 self
9564 }
9565}
9566
9567#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9568#[serde(try_from = "ShapeQueryRepr", into = "ShapeQueryRepr")]
9569#[non_exhaustive]
9570pub struct ShapeQuery {
9571 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9576 pub boost: ::core::option::Option<f32>,
9577 #[serde(
9578 rename = "_name",
9579 skip_serializing_if = "::core::option::Option::is_none"
9580 )]
9581 pub name: ::core::option::Option<::std::string::String>,
9582 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9584 pub ignore_unmapped: ::core::option::Option<bool>,
9585 pub field: crate::Field,
9587 pub shape: crate::query_dsl::ShapeFieldQuery,
9589}
9590
9591impl ShapeQuery {
9592 pub fn new(
9594 field: impl ::core::convert::Into<crate::Field>,
9595 shape: impl ::core::convert::Into<crate::query_dsl::ShapeFieldQuery>,
9596 ) -> Self {
9597 Self {
9598 boost: ::core::option::Option::None,
9599 name: ::core::option::Option::None,
9600 ignore_unmapped: ::core::option::Option::None,
9601 field: field.into(),
9602 shape: shape.into(),
9603 }
9604 }
9605}
9606
9607impl ShapeQuery {
9608 pub fn boost(mut self, value: f32) -> Self {
9610 self.boost = ::core::option::Option::Some(value.into());
9611 self
9612 }
9613 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9615 self.name = ::core::option::Option::Some(value.into());
9616 self
9617 }
9618 pub fn ignore_unmapped(mut self, value: bool) -> Self {
9620 self.ignore_unmapped = ::core::option::Option::Some(value.into());
9621 self
9622 }
9623}
9624
9625#[derive(::serde::Serialize, ::serde::Deserialize)]
9626struct ShapeQueryRepr {
9627 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9632 boost: ::core::option::Option<f32>,
9633 #[serde(
9634 rename = "_name",
9635 skip_serializing_if = "::core::option::Option::is_none"
9636 )]
9637 name: ::core::option::Option<::std::string::String>,
9638 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9640 ignore_unmapped: ::core::option::Option<bool>,
9641 #[serde(flatten)]
9642 keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::ShapeFieldQuery>,
9643}
9644
9645impl ::core::convert::TryFrom<ShapeQueryRepr> for ShapeQuery {
9646 type Error = ::std::string::String;
9647 fn try_from(repr: ShapeQueryRepr) -> ::core::result::Result<Self, Self::Error> {
9648 let mut keyed = repr.keyed__.into_iter();
9649 match (keyed.next(), keyed.next()) {
9650 (::core::option::Option::Some((field, shape)), ::core::option::Option::None) => {
9651 ::core::result::Result::Ok(Self {
9652 boost: repr.boost,
9653 name: repr.name,
9654 ignore_unmapped: repr.ignore_unmapped,
9655 field,
9656 shape,
9657 })
9658 }
9659 _ => ::core::result::Result::Err(::std::string::String::from(
9660 "ShapeQuery needs exactly one property keyed by its field",
9661 )),
9662 }
9663 }
9664}
9665
9666impl ::core::convert::From<ShapeQuery> for ShapeQueryRepr {
9667 fn from(value: ShapeQuery) -> Self {
9668 let mut keyed__ = ::indexmap::IndexMap::new();
9669 keyed__.insert(value.field, value.shape);
9670 Self {
9671 boost: value.boost,
9672 name: value.name,
9673 ignore_unmapped: value.ignore_unmapped,
9674 keyed__,
9675 }
9676 }
9677}
9678
9679#[derive(Clone, Debug, PartialEq, Eq, Hash)]
9680#[non_exhaustive]
9681pub enum SimpleQueryStringFlag {
9682 None,
9684 And,
9686 Not,
9688 Or,
9690 Prefix,
9692 Phrase,
9694 Precedence,
9696 Escape,
9698 Whitespace,
9700 Fuzzy,
9702 Near,
9705 Slop,
9708 All,
9710 Raw(::std::string::String),
9712}
9713
9714impl SimpleQueryStringFlag {
9715 pub fn as_str(&self) -> &str {
9717 match self {
9718 Self::None => "NONE",
9719 Self::And => "AND",
9720 Self::Not => "NOT",
9721 Self::Or => "OR",
9722 Self::Prefix => "PREFIX",
9723 Self::Phrase => "PHRASE",
9724 Self::Precedence => "PRECEDENCE",
9725 Self::Escape => "ESCAPE",
9726 Self::Whitespace => "WHITESPACE",
9727 Self::Fuzzy => "FUZZY",
9728 Self::Near => "NEAR",
9729 Self::Slop => "SLOP",
9730 Self::All => "ALL",
9731 Self::Raw(value) => value,
9732 }
9733 }
9734
9735 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
9737 match value {
9738 "NONE" => ::core::option::Option::Some(Self::None),
9739 "AND" => ::core::option::Option::Some(Self::And),
9740 "NOT" => ::core::option::Option::Some(Self::Not),
9741 "OR" => ::core::option::Option::Some(Self::Or),
9742 "PREFIX" => ::core::option::Option::Some(Self::Prefix),
9743 "PHRASE" => ::core::option::Option::Some(Self::Phrase),
9744 "PRECEDENCE" => ::core::option::Option::Some(Self::Precedence),
9745 "ESCAPE" => ::core::option::Option::Some(Self::Escape),
9746 "WHITESPACE" => ::core::option::Option::Some(Self::Whitespace),
9747 "FUZZY" => ::core::option::Option::Some(Self::Fuzzy),
9748 "NEAR" => ::core::option::Option::Some(Self::Near),
9749 "SLOP" => ::core::option::Option::Some(Self::Slop),
9750 "ALL" => ::core::option::Option::Some(Self::All),
9751 _ => ::core::option::Option::None,
9752 }
9753 }
9754}
9755
9756impl ::serde::Serialize for SimpleQueryStringFlag {
9757 fn serialize<S__: ::serde::Serializer>(
9758 &self,
9759 serializer: S__,
9760 ) -> ::core::result::Result<S__::Ok, S__::Error> {
9761 serializer.serialize_str(self.as_str())
9762 }
9763}
9764
9765impl<'de> ::serde::Deserialize<'de> for SimpleQueryStringFlag {
9766 fn deserialize<D__: ::serde::Deserializer<'de>>(
9767 deserializer: D__,
9768 ) -> ::core::result::Result<Self, D__::Error> {
9769 ::oxsearch_core::__private::deserialize_string_enum(
9770 deserializer,
9771 "SimpleQueryStringFlag",
9772 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
9773 )
9774 }
9775}
9776
9777pub type SimpleQueryStringFlags =
9779 ::oxsearch_core::shapes::PipeSeparatedFlags<crate::query_dsl::SimpleQueryStringFlag>;
9780
9781#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9782#[non_exhaustive]
9783pub struct SimpleQueryStringQuery {
9784 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9789 pub boost: ::core::option::Option<f32>,
9790 #[serde(
9791 rename = "_name",
9792 skip_serializing_if = "::core::option::Option::is_none"
9793 )]
9794 pub name: ::core::option::Option<::std::string::String>,
9795 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9797 pub analyzer: ::core::option::Option<::std::string::String>,
9798 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9800 pub analyze_wildcard: ::core::option::Option<bool>,
9801 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9803 pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
9804 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9806 pub default_operator: ::core::option::Option<crate::query_dsl::Operator>,
9807 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9812 pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
9813 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9815 pub flags: ::core::option::Option<crate::query_dsl::SimpleQueryStringFlags>,
9816 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9818 pub fuzzy_max_expansions: ::core::option::Option<i32>,
9819 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9821 pub fuzzy_prefix_length: ::core::option::Option<i32>,
9822 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9824 pub fuzzy_transpositions: ::core::option::Option<bool>,
9825 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9827 pub lenient: ::core::option::Option<bool>,
9828 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9830 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
9831 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9833 pub query: ::core::option::Option<::std::string::String>,
9834 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9836 pub quote_field_suffix: ::core::option::Option<::std::string::String>,
9837}
9838
9839impl SimpleQueryStringQuery {
9840 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
9842 Self {
9843 boost: ::core::option::Option::None,
9844 name: ::core::option::Option::None,
9845 analyzer: ::core::option::Option::None,
9846 analyze_wildcard: ::core::option::Option::None,
9847 auto_generate_synonyms_phrase_query: ::core::option::Option::None,
9848 default_operator: ::core::option::Option::None,
9849 fields: ::core::option::Option::None,
9850 flags: ::core::option::Option::None,
9851 fuzzy_max_expansions: ::core::option::Option::None,
9852 fuzzy_prefix_length: ::core::option::Option::None,
9853 fuzzy_transpositions: ::core::option::Option::None,
9854 lenient: ::core::option::Option::None,
9855 minimum_should_match: ::core::option::Option::None,
9856 query: ::core::option::Option::Some(query.into()),
9857 quote_field_suffix: ::core::option::Option::None,
9858 }
9859 }
9860}
9861
9862impl SimpleQueryStringQuery {
9863 pub fn boost(mut self, value: f32) -> Self {
9865 self.boost = ::core::option::Option::Some(value.into());
9866 self
9867 }
9868 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9870 self.name = ::core::option::Option::Some(value.into());
9871 self
9872 }
9873 pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9875 self.analyzer = ::core::option::Option::Some(value.into());
9876 self
9877 }
9878 pub fn analyze_wildcard(mut self, value: bool) -> Self {
9880 self.analyze_wildcard = ::core::option::Option::Some(value.into());
9881 self
9882 }
9883 pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
9885 self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
9886 self
9887 }
9888 pub fn default_operator(
9890 mut self,
9891 value: impl ::core::convert::Into<crate::query_dsl::Operator>,
9892 ) -> Self {
9893 self.default_operator = ::core::option::Option::Some(value.into());
9894 self
9895 }
9896 pub fn fields(
9898 mut self,
9899 value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
9900 ) -> Self {
9901 self.fields = ::core::option::Option::Some(value.into());
9902 self
9903 }
9904 pub fn flags(
9906 mut self,
9907 value: impl ::core::convert::Into<crate::query_dsl::SimpleQueryStringFlags>,
9908 ) -> Self {
9909 self.flags = ::core::option::Option::Some(value.into());
9910 self
9911 }
9912 pub fn fuzzy_max_expansions(mut self, value: i32) -> Self {
9914 self.fuzzy_max_expansions = ::core::option::Option::Some(value.into());
9915 self
9916 }
9917 pub fn fuzzy_prefix_length(mut self, value: i32) -> Self {
9919 self.fuzzy_prefix_length = ::core::option::Option::Some(value.into());
9920 self
9921 }
9922 pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
9924 self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
9925 self
9926 }
9927 pub fn lenient(mut self, value: bool) -> Self {
9929 self.lenient = ::core::option::Option::Some(value.into());
9930 self
9931 }
9932 pub fn minimum_should_match(
9934 mut self,
9935 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
9936 ) -> Self {
9937 self.minimum_should_match = ::core::option::Option::Some(value.into());
9938 self
9939 }
9940 pub fn quote_field_suffix(
9942 mut self,
9943 value: impl ::core::convert::Into<::std::string::String>,
9944 ) -> Self {
9945 self.quote_field_suffix = ::core::option::Option::Some(value.into());
9946 self
9947 }
9948}
9949
9950#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9951#[non_exhaustive]
9952pub struct SpanContainingQuery {
9953 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9958 pub boost: ::core::option::Option<f32>,
9959 #[serde(
9960 rename = "_name",
9961 skip_serializing_if = "::core::option::Option::is_none"
9962 )]
9963 pub name: ::core::option::Option<::std::string::String>,
9964 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9967 pub big: ::core::option::Option<crate::query_dsl::SpanQuery>,
9968 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9971 pub little: ::core::option::Option<crate::query_dsl::SpanQuery>,
9972}
9973
9974impl SpanContainingQuery {
9975 pub fn new(
9977 big: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
9978 little: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
9979 ) -> Self {
9980 Self {
9981 boost: ::core::option::Option::None,
9982 name: ::core::option::Option::None,
9983 big: ::core::option::Option::Some(big.into()),
9984 little: ::core::option::Option::Some(little.into()),
9985 }
9986 }
9987}
9988
9989impl SpanContainingQuery {
9990 pub fn boost(mut self, value: f32) -> Self {
9992 self.boost = ::core::option::Option::Some(value.into());
9993 self
9994 }
9995 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9997 self.name = ::core::option::Option::Some(value.into());
9998 self
9999 }
10000}
10001
10002#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10003#[non_exhaustive]
10004pub struct SpanFieldMaskingQuery {
10005 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10010 pub boost: ::core::option::Option<f32>,
10011 #[serde(
10012 rename = "_name",
10013 skip_serializing_if = "::core::option::Option::is_none"
10014 )]
10015 pub name: ::core::option::Option<::std::string::String>,
10016 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10017 pub field: ::core::option::Option<crate::Field>,
10018 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10019 pub query: ::core::option::Option<crate::query_dsl::SpanQuery>,
10020}
10021
10022impl SpanFieldMaskingQuery {
10023 pub fn new(
10025 field: impl ::core::convert::Into<crate::Field>,
10026 query: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10027 ) -> Self {
10028 Self {
10029 boost: ::core::option::Option::None,
10030 name: ::core::option::Option::None,
10031 field: ::core::option::Option::Some(field.into()),
10032 query: ::core::option::Option::Some(query.into()),
10033 }
10034 }
10035}
10036
10037impl SpanFieldMaskingQuery {
10038 pub fn boost(mut self, value: f32) -> Self {
10040 self.boost = ::core::option::Option::Some(value.into());
10041 self
10042 }
10043 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10045 self.name = ::core::option::Option::Some(value.into());
10046 self
10047 }
10048}
10049
10050#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10051#[non_exhaustive]
10052pub struct SpanFirstQuery {
10053 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10058 pub boost: ::core::option::Option<f32>,
10059 #[serde(
10060 rename = "_name",
10061 skip_serializing_if = "::core::option::Option::is_none"
10062 )]
10063 pub name: ::core::option::Option<::std::string::String>,
10064 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10066 pub end: ::core::option::Option<i32>,
10067 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10069 pub r#match: ::core::option::Option<crate::query_dsl::SpanQuery>,
10070}
10071
10072impl SpanFirstQuery {
10073 pub fn new(end: i32, r#match: impl ::core::convert::Into<crate::query_dsl::SpanQuery>) -> Self {
10075 Self {
10076 boost: ::core::option::Option::None,
10077 name: ::core::option::Option::None,
10078 end: ::core::option::Option::Some(end.into()),
10079 r#match: ::core::option::Option::Some(r#match.into()),
10080 }
10081 }
10082}
10083
10084impl SpanFirstQuery {
10085 pub fn boost(mut self, value: f32) -> Self {
10087 self.boost = ::core::option::Option::Some(value.into());
10088 self
10089 }
10090 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10092 self.name = ::core::option::Option::Some(value.into());
10093 self
10094 }
10095}
10096
10097pub type SpanGapQuery = ::oxsearch_core::shapes::SingleKey<crate::Field, i32>;
10099
10100#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10101#[non_exhaustive]
10102pub struct SpanMultiTermQuery {
10103 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10108 pub boost: ::core::option::Option<f32>,
10109 #[serde(
10110 rename = "_name",
10111 skip_serializing_if = "::core::option::Option::is_none"
10112 )]
10113 pub name: ::core::option::Option<::std::string::String>,
10114 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10116 pub r#match: ::core::option::Option<crate::query_dsl::QueryContainer>,
10117}
10118
10119impl SpanMultiTermQuery {
10120 pub fn new(r#match: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
10122 Self {
10123 boost: ::core::option::Option::None,
10124 name: ::core::option::Option::None,
10125 r#match: ::core::option::Option::Some(r#match.into()),
10126 }
10127 }
10128}
10129
10130impl SpanMultiTermQuery {
10131 pub fn boost(mut self, value: f32) -> Self {
10133 self.boost = ::core::option::Option::Some(value.into());
10134 self
10135 }
10136 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10138 self.name = ::core::option::Option::Some(value.into());
10139 self
10140 }
10141}
10142
10143#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10144#[non_exhaustive]
10145pub struct SpanNearQuery {
10146 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10151 pub boost: ::core::option::Option<f32>,
10152 #[serde(
10153 rename = "_name",
10154 skip_serializing_if = "::core::option::Option::is_none"
10155 )]
10156 pub name: ::core::option::Option<::std::string::String>,
10157 #[serde(default = "::core::default::Default::default")]
10159 pub clauses: ::std::vec::Vec<crate::query_dsl::SpanQuery>,
10160 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10162 pub in_order: ::core::option::Option<bool>,
10163 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10165 pub slop: ::core::option::Option<i32>,
10166}
10167
10168impl SpanNearQuery {
10169 pub fn new(
10171 clauses: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::SpanQuery>>,
10172 ) -> Self {
10173 Self {
10174 boost: ::core::option::Option::None,
10175 name: ::core::option::Option::None,
10176 clauses: clauses.into(),
10177 in_order: ::core::option::Option::None,
10178 slop: ::core::option::Option::None,
10179 }
10180 }
10181}
10182
10183impl SpanNearQuery {
10184 pub fn boost(mut self, value: f32) -> Self {
10186 self.boost = ::core::option::Option::Some(value.into());
10187 self
10188 }
10189 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10191 self.name = ::core::option::Option::Some(value.into());
10192 self
10193 }
10194 pub fn in_order(mut self, value: bool) -> Self {
10196 self.in_order = ::core::option::Option::Some(value.into());
10197 self
10198 }
10199 pub fn slop(mut self, value: i32) -> Self {
10201 self.slop = ::core::option::Option::Some(value.into());
10202 self
10203 }
10204}
10205
10206#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10207#[non_exhaustive]
10208pub struct SpanNotQuery {
10209 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10214 pub boost: ::core::option::Option<f32>,
10215 #[serde(
10216 rename = "_name",
10217 skip_serializing_if = "::core::option::Option::is_none"
10218 )]
10219 pub name: ::core::option::Option<::std::string::String>,
10220 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10223 pub dist: ::core::option::Option<i32>,
10224 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10226 pub exclude: ::core::option::Option<crate::query_dsl::SpanQuery>,
10227 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10229 pub include: ::core::option::Option<crate::query_dsl::SpanQuery>,
10230 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10232 pub post: ::core::option::Option<i32>,
10233 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10235 pub pre: ::core::option::Option<i32>,
10236}
10237
10238impl SpanNotQuery {
10239 pub fn new(
10241 exclude: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10242 include: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10243 ) -> Self {
10244 Self {
10245 boost: ::core::option::Option::None,
10246 name: ::core::option::Option::None,
10247 dist: ::core::option::Option::None,
10248 exclude: ::core::option::Option::Some(exclude.into()),
10249 include: ::core::option::Option::Some(include.into()),
10250 post: ::core::option::Option::None,
10251 pre: ::core::option::Option::None,
10252 }
10253 }
10254}
10255
10256impl SpanNotQuery {
10257 pub fn boost(mut self, value: f32) -> Self {
10259 self.boost = ::core::option::Option::Some(value.into());
10260 self
10261 }
10262 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10264 self.name = ::core::option::Option::Some(value.into());
10265 self
10266 }
10267 pub fn dist(mut self, value: i32) -> Self {
10269 self.dist = ::core::option::Option::Some(value.into());
10270 self
10271 }
10272 pub fn post(mut self, value: i32) -> Self {
10274 self.post = ::core::option::Option::Some(value.into());
10275 self
10276 }
10277 pub fn pre(mut self, value: i32) -> Self {
10279 self.pre = ::core::option::Option::Some(value.into());
10280 self
10281 }
10282}
10283
10284#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10285#[non_exhaustive]
10286pub struct SpanOrQuery {
10287 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10292 pub boost: ::core::option::Option<f32>,
10293 #[serde(
10294 rename = "_name",
10295 skip_serializing_if = "::core::option::Option::is_none"
10296 )]
10297 pub name: ::core::option::Option<::std::string::String>,
10298 #[serde(default = "::core::default::Default::default")]
10300 pub clauses: ::std::vec::Vec<crate::query_dsl::SpanQuery>,
10301}
10302
10303impl SpanOrQuery {
10304 pub fn new(
10306 clauses: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::SpanQuery>>,
10307 ) -> Self {
10308 Self {
10309 boost: ::core::option::Option::None,
10310 name: ::core::option::Option::None,
10311 clauses: clauses.into(),
10312 }
10313 }
10314}
10315
10316impl SpanOrQuery {
10317 pub fn boost(mut self, value: f32) -> Self {
10319 self.boost = ::core::option::Option::Some(value.into());
10320 self
10321 }
10322 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10324 self.name = ::core::option::Option::Some(value.into());
10325 self
10326 }
10327}
10328
10329#[derive(Clone, Debug, PartialEq)]
10330#[non_exhaustive]
10331pub enum SpanQuery {
10332 SpanContaining(::std::boxed::Box<crate::query_dsl::SpanContainingQuery>),
10334 SpanFieldMasking(::std::boxed::Box<crate::query_dsl::SpanFieldMaskingQuery>),
10336 SpanFirst(::std::boxed::Box<crate::query_dsl::SpanFirstQuery>),
10338 SpanGap(crate::query_dsl::SpanGapQuery),
10339 SpanMulti(::std::boxed::Box<crate::query_dsl::SpanMultiTermQuery>),
10341 SpanNear(crate::query_dsl::SpanNearQuery),
10343 SpanNot(::std::boxed::Box<crate::query_dsl::SpanNotQuery>),
10345 SpanOr(crate::query_dsl::SpanOrQuery),
10347 SpanTerm(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>),
10349 SpanWithin(::std::boxed::Box<crate::query_dsl::SpanWithinQuery>),
10351 Raw(::serde_json::Value),
10353}
10354
10355impl SpanQuery {
10356 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
10358 &self,
10359 map: &mut M__,
10360 ) -> ::core::result::Result<(), M__::Error> {
10361 match self {
10362 Self::SpanContaining(value) => map.serialize_entry("span_containing", value),
10363 Self::SpanFieldMasking(value) => map.serialize_entry("span_field_masking", value),
10364 Self::SpanFirst(value) => map.serialize_entry("span_first", value),
10365 Self::SpanGap(value) => map.serialize_entry("span_gap", value),
10366 Self::SpanMulti(value) => map.serialize_entry("span_multi", value),
10367 Self::SpanNear(value) => map.serialize_entry("span_near", value),
10368 Self::SpanNot(value) => map.serialize_entry("span_not", value),
10369 Self::SpanOr(value) => map.serialize_entry("span_or", value),
10370 Self::SpanTerm(value) => map.serialize_entry("span_term", value),
10371 Self::SpanWithin(value) => map.serialize_entry("span_within", value),
10372 Self::Raw(value) => match value {
10373 ::serde_json::Value::Object(entries) => {
10374 for (key, value) in entries {
10375 map.serialize_entry(key, value)?;
10376 }
10377 ::core::result::Result::Ok(())
10378 }
10379 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
10380 "a raw variant must be an object",
10381 )),
10382 },
10383 }
10384 }
10385}
10386
10387impl ::serde::Serialize for SpanQuery {
10388 fn serialize<S__: ::serde::Serializer>(
10389 &self,
10390 serializer: S__,
10391 ) -> ::core::result::Result<S__::Ok, S__::Error> {
10392 match self {
10393 Self::SpanContaining(value) => {
10394 ::oxsearch_core::__private::serialize_variant(serializer, "span_containing", value)
10395 }
10396 Self::SpanFieldMasking(value) => ::oxsearch_core::__private::serialize_variant(
10397 serializer,
10398 "span_field_masking",
10399 value,
10400 ),
10401 Self::SpanFirst(value) => {
10402 ::oxsearch_core::__private::serialize_variant(serializer, "span_first", value)
10403 }
10404 Self::SpanGap(value) => {
10405 ::oxsearch_core::__private::serialize_variant(serializer, "span_gap", value)
10406 }
10407 Self::SpanMulti(value) => {
10408 ::oxsearch_core::__private::serialize_variant(serializer, "span_multi", value)
10409 }
10410 Self::SpanNear(value) => {
10411 ::oxsearch_core::__private::serialize_variant(serializer, "span_near", value)
10412 }
10413 Self::SpanNot(value) => {
10414 ::oxsearch_core::__private::serialize_variant(serializer, "span_not", value)
10415 }
10416 Self::SpanOr(value) => {
10417 ::oxsearch_core::__private::serialize_variant(serializer, "span_or", value)
10418 }
10419 Self::SpanTerm(value) => {
10420 ::oxsearch_core::__private::serialize_variant(serializer, "span_term", value)
10421 }
10422 Self::SpanWithin(value) => {
10423 ::oxsearch_core::__private::serialize_variant(serializer, "span_within", value)
10424 }
10425 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
10426 }
10427 }
10428}
10429
10430impl<'de> ::serde::Deserialize<'de> for SpanQuery {
10431 fn deserialize<D__: ::serde::Deserializer<'de>>(
10432 deserializer: D__,
10433 ) -> ::core::result::Result<Self, D__::Error> {
10434 ::oxsearch_core::__private::deserialize_container(deserializer)
10435 }
10436}
10437
10438impl<'de> ::oxsearch_core::__private::Container<'de> for SpanQuery {
10439 const NAME: &'static str = "SpanQuery";
10440 fn variant<A__: ::serde::de::MapAccess<'de>>(
10441 key: &str,
10442 map: &mut A__,
10443 ) -> ::core::result::Result<Self, A__::Error> {
10444 ::core::result::Result::Ok(match key {
10445 "span_containing" => Self::SpanContaining(map.next_value()?),
10446 "span_field_masking" => Self::SpanFieldMasking(map.next_value()?),
10447 "span_first" => Self::SpanFirst(map.next_value()?),
10448 "span_gap" => Self::SpanGap(map.next_value()?),
10449 "span_multi" => Self::SpanMulti(map.next_value()?),
10450 "span_near" => Self::SpanNear(map.next_value()?),
10451 "span_not" => Self::SpanNot(map.next_value()?),
10452 "span_or" => Self::SpanOr(map.next_value()?),
10453 "span_term" => Self::SpanTerm(map.next_value()?),
10454 "span_within" => Self::SpanWithin(map.next_value()?),
10455 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
10456 key,
10457 map.next_value()?,
10458 )),
10459 })
10460 }
10461}
10462
10463impl ::core::convert::From<crate::query_dsl::SpanContainingQuery> for SpanQuery {
10464 fn from(value: crate::query_dsl::SpanContainingQuery) -> Self {
10465 Self::SpanContaining(::std::boxed::Box::new(value))
10466 }
10467}
10468
10469impl ::core::convert::From<crate::query_dsl::SpanFieldMaskingQuery> for SpanQuery {
10470 fn from(value: crate::query_dsl::SpanFieldMaskingQuery) -> Self {
10471 Self::SpanFieldMasking(::std::boxed::Box::new(value))
10472 }
10473}
10474
10475impl ::core::convert::From<crate::query_dsl::SpanFirstQuery> for SpanQuery {
10476 fn from(value: crate::query_dsl::SpanFirstQuery) -> Self {
10477 Self::SpanFirst(::std::boxed::Box::new(value))
10478 }
10479}
10480
10481impl ::core::convert::From<crate::query_dsl::SpanGapQuery> for SpanQuery {
10482 fn from(value: crate::query_dsl::SpanGapQuery) -> Self {
10483 Self::SpanGap(value)
10484 }
10485}
10486
10487impl ::core::convert::From<crate::query_dsl::SpanMultiTermQuery> for SpanQuery {
10488 fn from(value: crate::query_dsl::SpanMultiTermQuery) -> Self {
10489 Self::SpanMulti(::std::boxed::Box::new(value))
10490 }
10491}
10492
10493impl ::core::convert::From<crate::query_dsl::SpanNearQuery> for SpanQuery {
10494 fn from(value: crate::query_dsl::SpanNearQuery) -> Self {
10495 Self::SpanNear(value)
10496 }
10497}
10498
10499impl ::core::convert::From<crate::query_dsl::SpanNotQuery> for SpanQuery {
10500 fn from(value: crate::query_dsl::SpanNotQuery) -> Self {
10501 Self::SpanNot(::std::boxed::Box::new(value))
10502 }
10503}
10504
10505impl ::core::convert::From<crate::query_dsl::SpanOrQuery> for SpanQuery {
10506 fn from(value: crate::query_dsl::SpanOrQuery) -> Self {
10507 Self::SpanOr(value)
10508 }
10509}
10510
10511impl
10512 ::core::convert::From<
10513 ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
10514 > for SpanQuery
10515{
10516 fn from(
10517 value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
10518 ) -> Self {
10519 Self::SpanTerm(value)
10520 }
10521}
10522
10523impl ::core::convert::From<crate::query_dsl::SpanWithinQuery> for SpanQuery {
10524 fn from(value: crate::query_dsl::SpanWithinQuery) -> Self {
10525 Self::SpanWithin(::std::boxed::Box::new(value))
10526 }
10527}
10528
10529#[derive(Clone, Debug, PartialEq)]
10530#[non_exhaustive]
10531pub struct SpanTermQuery {
10532 pub boost: ::core::option::Option<f32>,
10537 pub name: ::core::option::Option<::std::string::String>,
10538 pub value: ::core::option::Option<crate::FieldValue>,
10539}
10540
10541impl SpanTermQuery {
10542 pub fn new(value: impl ::core::convert::Into<crate::FieldValue>) -> Self {
10544 Self {
10545 boost: ::core::option::Option::None,
10546 name: ::core::option::Option::None,
10547 value: ::core::option::Option::Some(value.into()),
10548 }
10549 }
10550}
10551
10552impl SpanTermQuery {
10553 pub fn boost(mut self, value: f32) -> Self {
10555 self.boost = ::core::option::Option::Some(value.into());
10556 self
10557 }
10558 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10560 self.name = ::core::option::Option::Some(value.into());
10561 self
10562 }
10563}
10564
10565#[derive(::serde::Serialize, ::serde::Deserialize)]
10566#[serde(remote = "SpanTermQuery")]
10567struct SpanTermQueryDef {
10568 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10573 boost: ::core::option::Option<f32>,
10574 #[serde(
10575 rename = "_name",
10576 skip_serializing_if = "::core::option::Option::is_none"
10577 )]
10578 name: ::core::option::Option<::std::string::String>,
10579 #[serde(
10580 alias = "term",
10581 skip_serializing_if = "::core::option::Option::is_none"
10582 )]
10583 value: ::core::option::Option<crate::FieldValue>,
10584}
10585
10586impl ::serde::Serialize for SpanTermQuery {
10587 fn serialize<S__: ::serde::Serializer>(
10588 &self,
10589 serializer: S__,
10590 ) -> ::core::result::Result<S__::Ok, S__::Error> {
10591 if let (::core::option::Option::Some(short), true) =
10592 (&self.value, self.boost.is_none() && self.name.is_none())
10593 {
10594 return ::serde::Serialize::serialize(short, serializer);
10595 }
10596 SpanTermQueryDef::serialize(self, serializer)
10597 }
10598}
10599
10600impl<'de> ::oxsearch_core::__private::Shorthand<'de> for SpanTermQuery {
10601 type Short = crate::FieldValue;
10602 fn from_short(short: crate::FieldValue) -> Self {
10603 Self {
10604 boost: ::core::option::Option::None,
10605 name: ::core::option::Option::None,
10606 value: ::core::option::Option::Some(short),
10607 }
10608 }
10609 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
10610 deserializer: D__,
10611 ) -> ::core::result::Result<Self, D__::Error> {
10612 SpanTermQueryDef::deserialize(deserializer)
10613 }
10614}
10615
10616impl<'de> ::serde::Deserialize<'de> for SpanTermQuery {
10617 fn deserialize<D__: ::serde::Deserializer<'de>>(
10618 deserializer: D__,
10619 ) -> ::core::result::Result<Self, D__::Error> {
10620 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
10621 }
10622}
10623
10624#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10625#[non_exhaustive]
10626pub struct SpanWithinQuery {
10627 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10632 pub boost: ::core::option::Option<f32>,
10633 #[serde(
10634 rename = "_name",
10635 skip_serializing_if = "::core::option::Option::is_none"
10636 )]
10637 pub name: ::core::option::Option<::std::string::String>,
10638 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10641 pub big: ::core::option::Option<crate::query_dsl::SpanQuery>,
10642 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10645 pub little: ::core::option::Option<crate::query_dsl::SpanQuery>,
10646}
10647
10648impl SpanWithinQuery {
10649 pub fn new(
10651 big: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10652 little: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10653 ) -> Self {
10654 Self {
10655 boost: ::core::option::Option::None,
10656 name: ::core::option::Option::None,
10657 big: ::core::option::Option::Some(big.into()),
10658 little: ::core::option::Option::Some(little.into()),
10659 }
10660 }
10661}
10662
10663impl SpanWithinQuery {
10664 pub fn boost(mut self, value: f32) -> Self {
10666 self.boost = ::core::option::Option::Some(value.into());
10667 self
10668 }
10669 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10671 self.name = ::core::option::Option::Some(value.into());
10672 self
10673 }
10674}
10675
10676#[derive(Clone, Debug, PartialEq)]
10678#[non_exhaustive]
10679pub enum SparseVectorQueryVariant {
10680 QueryVector(::indexmap::IndexMap<::std::string::String, f32>),
10683 InferenceId(crate::Id),
10689 Raw(::serde_json::Value),
10691}
10692
10693impl SparseVectorQueryVariant {
10694 pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
10696 &self,
10697 map: &mut M__,
10698 ) -> ::core::result::Result<(), M__::Error> {
10699 match self {
10700 Self::QueryVector(value) => map.serialize_entry("query_vector", value),
10701 Self::InferenceId(value) => map.serialize_entry("inference_id", value),
10702 Self::Raw(value) => match value {
10703 ::serde_json::Value::Object(entries) => {
10704 for (key, value) in entries {
10705 map.serialize_entry(key, value)?;
10706 }
10707 ::core::result::Result::Ok(())
10708 }
10709 _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
10710 "a raw variant must be an object",
10711 )),
10712 },
10713 }
10714 }
10715}
10716
10717impl ::serde::Serialize for SparseVectorQueryVariant {
10718 fn serialize<S__: ::serde::Serializer>(
10719 &self,
10720 serializer: S__,
10721 ) -> ::core::result::Result<S__::Ok, S__::Error> {
10722 match self {
10723 Self::QueryVector(value) => {
10724 ::oxsearch_core::__private::serialize_variant(serializer, "query_vector", value)
10725 }
10726 Self::InferenceId(value) => {
10727 ::oxsearch_core::__private::serialize_variant(serializer, "inference_id", value)
10728 }
10729 Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
10730 }
10731 }
10732}
10733
10734impl<'de> ::serde::Deserialize<'de> for SparseVectorQueryVariant {
10735 fn deserialize<D__: ::serde::Deserializer<'de>>(
10736 deserializer: D__,
10737 ) -> ::core::result::Result<Self, D__::Error> {
10738 ::oxsearch_core::__private::deserialize_container(deserializer)
10739 }
10740}
10741
10742impl<'de> ::oxsearch_core::__private::Container<'de> for SparseVectorQueryVariant {
10743 const NAME: &'static str = "SparseVectorQueryVariant";
10744 fn variant<A__: ::serde::de::MapAccess<'de>>(
10745 key: &str,
10746 map: &mut A__,
10747 ) -> ::core::result::Result<Self, A__::Error> {
10748 ::core::result::Result::Ok(match key {
10749 "query_vector" => Self::QueryVector(map.next_value()?),
10750 "inference_id" => Self::InferenceId(map.next_value()?),
10751 _ => Self::Raw(::oxsearch_core::__private::raw_variant(
10752 key,
10753 map.next_value()?,
10754 )),
10755 })
10756 }
10757}
10758
10759impl ::core::convert::From<::indexmap::IndexMap<::std::string::String, f32>>
10760 for SparseVectorQueryVariant
10761{
10762 fn from(value: ::indexmap::IndexMap<::std::string::String, f32>) -> Self {
10763 Self::QueryVector(value)
10764 }
10765}
10766
10767impl ::core::convert::From<crate::Id> for SparseVectorQueryVariant {
10768 fn from(value: crate::Id) -> Self {
10769 Self::InferenceId(value)
10770 }
10771}
10772
10773impl ::core::convert::From<&str> for SparseVectorQueryVariant {
10774 fn from(value: &str) -> Self {
10775 Self::InferenceId(::std::borrow::ToOwned::to_owned(value))
10776 }
10777}
10778
10779#[derive(Clone, Debug, PartialEq)]
10780#[non_exhaustive]
10781pub struct SparseVectorQuery {
10782 pub boost: ::core::option::Option<f32>,
10787 pub name: ::core::option::Option<::std::string::String>,
10788 pub field: ::core::option::Option<crate::Field>,
10791 pub query: ::core::option::Option<::std::string::String>,
10794 pub prune: ::core::option::Option<bool>,
10798 pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
10803 pub variant: ::core::option::Option<crate::query_dsl::SparseVectorQueryVariant>,
10805}
10806
10807impl SparseVectorQuery {
10808 pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
10810 Self {
10811 boost: ::core::option::Option::None,
10812 name: ::core::option::Option::None,
10813 field: ::core::option::Option::Some(field.into()),
10814 query: ::core::option::Option::None,
10815 prune: ::core::option::Option::None,
10816 pruning_config: ::core::option::Option::None,
10817 variant: ::core::option::Option::None,
10818 }
10819 }
10820}
10821
10822impl SparseVectorQuery {
10823 pub fn boost(mut self, value: f32) -> Self {
10825 self.boost = ::core::option::Option::Some(value.into());
10826 self
10827 }
10828 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10830 self.name = ::core::option::Option::Some(value.into());
10831 self
10832 }
10833 pub fn query(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10835 self.query = ::core::option::Option::Some(value.into());
10836 self
10837 }
10838 pub fn prune(mut self, value: bool) -> Self {
10840 self.prune = ::core::option::Option::Some(value.into());
10841 self
10842 }
10843 pub fn pruning_config(
10845 mut self,
10846 value: impl ::core::convert::Into<crate::TokenPruningConfig>,
10847 ) -> Self {
10848 self.pruning_config = ::core::option::Option::Some(value.into());
10849 self
10850 }
10851 pub fn variant(
10853 mut self,
10854 value: impl ::core::convert::Into<crate::query_dsl::SparseVectorQueryVariant>,
10855 ) -> Self {
10856 self.variant = ::core::option::Option::Some(value.into());
10857 self
10858 }
10859}
10860
10861impl ::serde::Serialize for SparseVectorQuery {
10862 fn serialize<S__: ::serde::Serializer>(
10863 &self,
10864 serializer: S__,
10865 ) -> ::core::result::Result<S__::Ok, S__::Error> {
10866 use ::serde::ser::SerializeMap as _;
10867 let mut map = serializer.serialize_map(::core::option::Option::None)?;
10868 if let ::core::option::Option::Some(value) = &self.boost {
10869 map.serialize_entry("boost", value)?;
10870 }
10871 if let ::core::option::Option::Some(value) = &self.name {
10872 map.serialize_entry("_name", value)?;
10873 }
10874 if let ::core::option::Option::Some(value) = &self.field {
10875 map.serialize_entry("field", value)?;
10876 }
10877 if let ::core::option::Option::Some(value) = &self.query {
10878 map.serialize_entry("query", value)?;
10879 }
10880 if let ::core::option::Option::Some(value) = &self.prune {
10881 map.serialize_entry("prune", value)?;
10882 }
10883 if let ::core::option::Option::Some(value) = &self.pruning_config {
10884 map.serialize_entry("pruning_config", value)?;
10885 }
10886 if let ::core::option::Option::Some(variant) = &self.variant {
10887 variant.serialize_entry(&mut map)?;
10888 }
10889 map.end()
10890 }
10891}
10892
10893impl<'de> ::serde::Deserialize<'de> for SparseVectorQuery {
10894 fn deserialize<D__: ::serde::Deserializer<'de>>(
10895 deserializer: D__,
10896 ) -> ::core::result::Result<Self, D__::Error> {
10897 struct Fields;
10898 impl<'de> ::serde::de::Visitor<'de> for Fields {
10899 type Value = SparseVectorQuery;
10900 fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
10901 f.write_str("a SparseVectorQuery object")
10902 }
10903 fn visit_map<A__: ::serde::de::MapAccess<'de>>(
10904 self,
10905 mut map: A__,
10906 ) -> ::core::result::Result<SparseVectorQuery, A__::Error> {
10907 let mut boost = ::core::option::Option::None;
10908 let mut name = ::core::option::Option::None;
10909 let mut field = ::core::option::Option::None;
10910 let mut query = ::core::option::Option::None;
10911 let mut prune = ::core::option::Option::None;
10912 let mut pruning_config = ::core::option::Option::None;
10913 let mut variant__ = ::core::option::Option::None;
10914 while let ::core::option::Option::Some(key) =
10915 map.next_key::<::std::string::String>()?
10916 {
10917 match key.as_str() {
10918 "boost" => boost = ::core::option::Option::Some(map.next_value()?),
10919 "_name" => name = ::core::option::Option::Some(map.next_value()?),
10920 "field" => field = ::core::option::Option::Some(map.next_value()?),
10921 "query" => query = ::core::option::Option::Some(map.next_value()?),
10922 "prune" => prune = ::core::option::Option::Some(map.next_value()?),
10923 "pruning_config" => {
10924 pruning_config = ::core::option::Option::Some(map.next_value()?)
10925 }
10926 _ => {
10927 if variant__.is_some() {
10928 return ::core::result::Result::Err(
10929 ::oxsearch_core::__private::two_variants(
10930 "SparseVectorQuery",
10931 &key,
10932 ),
10933 );
10934 }
10935 variant__ = ::core::option::Option::Some(<SparseVectorQueryVariant as ::oxsearch_core::__private::Container<'de>>::variant(&key, &mut map)?);
10936 }
10937 }
10938 }
10939 ::core::result::Result::Ok(SparseVectorQuery {
10940 boost,
10941 name,
10942 field,
10943 query,
10944 prune,
10945 pruning_config,
10946 variant: variant__,
10947 })
10948 }
10949 }
10950 deserializer.deserialize_map(Fields)
10951 }
10952}
10953
10954#[derive(Clone, Debug, PartialEq)]
10955#[non_exhaustive]
10956pub struct TermQuery {
10957 pub boost: ::core::option::Option<f32>,
10962 pub name: ::core::option::Option<::std::string::String>,
10963 pub value: ::core::option::Option<crate::FieldValue>,
10965 pub case_insensitive: ::core::option::Option<bool>,
10968}
10969
10970impl TermQuery {
10971 pub fn new(value: impl ::core::convert::Into<crate::FieldValue>) -> Self {
10973 Self {
10974 boost: ::core::option::Option::None,
10975 name: ::core::option::Option::None,
10976 value: ::core::option::Option::Some(value.into()),
10977 case_insensitive: ::core::option::Option::None,
10978 }
10979 }
10980}
10981
10982impl TermQuery {
10983 pub fn boost(mut self, value: f32) -> Self {
10985 self.boost = ::core::option::Option::Some(value.into());
10986 self
10987 }
10988 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10990 self.name = ::core::option::Option::Some(value.into());
10991 self
10992 }
10993 pub fn case_insensitive(mut self, value: bool) -> Self {
10995 self.case_insensitive = ::core::option::Option::Some(value.into());
10996 self
10997 }
10998}
10999
11000#[derive(::serde::Serialize, ::serde::Deserialize)]
11001#[serde(remote = "TermQuery")]
11002struct TermQueryDef {
11003 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11008 boost: ::core::option::Option<f32>,
11009 #[serde(
11010 rename = "_name",
11011 skip_serializing_if = "::core::option::Option::is_none"
11012 )]
11013 name: ::core::option::Option<::std::string::String>,
11014 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11016 value: ::core::option::Option<crate::FieldValue>,
11017 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11020 case_insensitive: ::core::option::Option<bool>,
11021}
11022
11023impl ::serde::Serialize for TermQuery {
11024 fn serialize<S__: ::serde::Serializer>(
11025 &self,
11026 serializer: S__,
11027 ) -> ::core::result::Result<S__::Ok, S__::Error> {
11028 if let (::core::option::Option::Some(short), true) = (
11029 &self.value,
11030 self.boost.is_none() && self.name.is_none() && self.case_insensitive.is_none(),
11031 ) {
11032 return ::serde::Serialize::serialize(short, serializer);
11033 }
11034 TermQueryDef::serialize(self, serializer)
11035 }
11036}
11037
11038impl<'de> ::oxsearch_core::__private::Shorthand<'de> for TermQuery {
11039 type Short = crate::FieldValue;
11040 fn from_short(short: crate::FieldValue) -> Self {
11041 Self {
11042 boost: ::core::option::Option::None,
11043 name: ::core::option::Option::None,
11044 value: ::core::option::Option::Some(short),
11045 case_insensitive: ::core::option::Option::None,
11046 }
11047 }
11048 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
11049 deserializer: D__,
11050 ) -> ::core::result::Result<Self, D__::Error> {
11051 TermQueryDef::deserialize(deserializer)
11052 }
11053}
11054
11055impl<'de> ::serde::Deserialize<'de> for TermQuery {
11056 fn deserialize<D__: ::serde::Deserializer<'de>>(
11057 deserializer: D__,
11058 ) -> ::core::result::Result<Self, D__::Error> {
11059 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
11060 }
11061}
11062
11063#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11064#[non_exhaustive]
11065pub struct TermRangeQuery {
11066 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11071 pub boost: ::core::option::Option<f32>,
11072 #[serde(
11073 rename = "_name",
11074 skip_serializing_if = "::core::option::Option::is_none"
11075 )]
11076 pub name: ::core::option::Option<::std::string::String>,
11077 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11079 pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
11080 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11082 pub gt: ::core::option::Option<::std::string::String>,
11083 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11085 pub gte: ::core::option::Option<::std::string::String>,
11086 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11088 pub lt: ::core::option::Option<::std::string::String>,
11089 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11091 pub lte: ::core::option::Option<::std::string::String>,
11092}
11093
11094impl TermRangeQuery {
11095 pub fn new() -> Self {
11097 Self {
11098 boost: ::core::option::Option::None,
11099 name: ::core::option::Option::None,
11100 relation: ::core::option::Option::None,
11101 gt: ::core::option::Option::None,
11102 gte: ::core::option::Option::None,
11103 lt: ::core::option::Option::None,
11104 lte: ::core::option::Option::None,
11105 }
11106 }
11107}
11108
11109impl TermRangeQuery {
11110 pub fn boost(mut self, value: f32) -> Self {
11112 self.boost = ::core::option::Option::Some(value.into());
11113 self
11114 }
11115 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11117 self.name = ::core::option::Option::Some(value.into());
11118 self
11119 }
11120 pub fn relation(
11122 mut self,
11123 value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
11124 ) -> Self {
11125 self.relation = ::core::option::Option::Some(value.into());
11126 self
11127 }
11128 pub fn gt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11130 self.gt = ::core::option::Option::Some(value.into());
11131 self
11132 }
11133 pub fn gte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11135 self.gte = ::core::option::Option::Some(value.into());
11136 self
11137 }
11138 pub fn lt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11140 self.lt = ::core::option::Option::Some(value.into());
11141 self
11142 }
11143 pub fn lte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11145 self.lte = ::core::option::Option::Some(value.into());
11146 self
11147 }
11148}
11149
11150#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11151#[non_exhaustive]
11152pub struct TermsLookup {
11153 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11154 pub index: ::core::option::Option<crate::IndexName>,
11155 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11156 pub id: ::core::option::Option<crate::Id>,
11157 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11158 pub path: ::core::option::Option<crate::Field>,
11159 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11160 pub routing: ::core::option::Option<::std::string::String>,
11161}
11162
11163impl TermsLookup {
11164 pub fn new(
11166 index: impl ::core::convert::Into<crate::IndexName>,
11167 id: impl ::core::convert::Into<crate::Id>,
11168 path: impl ::core::convert::Into<crate::Field>,
11169 ) -> Self {
11170 Self {
11171 index: ::core::option::Option::Some(index.into()),
11172 id: ::core::option::Option::Some(id.into()),
11173 path: ::core::option::Option::Some(path.into()),
11174 routing: ::core::option::Option::None,
11175 }
11176 }
11177}
11178
11179impl TermsLookup {
11180 pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11182 self.routing = ::core::option::Option::Some(value.into());
11183 self
11184 }
11185}
11186
11187#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11188#[serde(try_from = "TermsQueryRepr", into = "TermsQueryRepr")]
11189#[non_exhaustive]
11190pub struct TermsQuery {
11191 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11196 pub boost: ::core::option::Option<f32>,
11197 #[serde(
11198 rename = "_name",
11199 skip_serializing_if = "::core::option::Option::is_none"
11200 )]
11201 pub name: ::core::option::Option<::std::string::String>,
11202 pub field: crate::Field,
11204 pub terms: crate::query_dsl::TermsQueryField,
11206}
11207
11208impl TermsQuery {
11209 pub fn new(
11211 field: impl ::core::convert::Into<crate::Field>,
11212 terms: impl ::core::convert::Into<crate::query_dsl::TermsQueryField>,
11213 ) -> Self {
11214 Self {
11215 boost: ::core::option::Option::None,
11216 name: ::core::option::Option::None,
11217 field: field.into(),
11218 terms: terms.into(),
11219 }
11220 }
11221}
11222
11223impl TermsQuery {
11224 pub fn boost(mut self, value: f32) -> Self {
11226 self.boost = ::core::option::Option::Some(value.into());
11227 self
11228 }
11229 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11231 self.name = ::core::option::Option::Some(value.into());
11232 self
11233 }
11234}
11235
11236#[derive(::serde::Serialize, ::serde::Deserialize)]
11237struct TermsQueryRepr {
11238 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11243 boost: ::core::option::Option<f32>,
11244 #[serde(
11245 rename = "_name",
11246 skip_serializing_if = "::core::option::Option::is_none"
11247 )]
11248 name: ::core::option::Option<::std::string::String>,
11249 #[serde(flatten)]
11250 keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::TermsQueryField>,
11251}
11252
11253impl ::core::convert::TryFrom<TermsQueryRepr> for TermsQuery {
11254 type Error = ::std::string::String;
11255 fn try_from(repr: TermsQueryRepr) -> ::core::result::Result<Self, Self::Error> {
11256 let mut keyed = repr.keyed__.into_iter();
11257 match (keyed.next(), keyed.next()) {
11258 (::core::option::Option::Some((field, terms)), ::core::option::Option::None) => {
11259 ::core::result::Result::Ok(Self {
11260 boost: repr.boost,
11261 name: repr.name,
11262 field,
11263 terms,
11264 })
11265 }
11266 _ => ::core::result::Result::Err(::std::string::String::from(
11267 "TermsQuery needs exactly one property keyed by its field",
11268 )),
11269 }
11270 }
11271}
11272
11273impl ::core::convert::From<TermsQuery> for TermsQueryRepr {
11274 fn from(value: TermsQuery) -> Self {
11275 let mut keyed__ = ::indexmap::IndexMap::new();
11276 keyed__.insert(value.field, value.terms);
11277 Self {
11278 boost: value.boost,
11279 name: value.name,
11280 keyed__,
11281 }
11282 }
11283}
11284
11285#[derive(Clone, Debug, PartialEq)]
11286#[non_exhaustive]
11287pub enum TermsQueryField {
11288 Value(::std::vec::Vec<crate::FieldValue>),
11290 Lookup(crate::query_dsl::TermsLookup),
11292}
11293
11294impl ::serde::Serialize for TermsQueryField {
11295 fn serialize<S__: ::serde::Serializer>(
11296 &self,
11297 serializer: S__,
11298 ) -> ::core::result::Result<S__::Ok, S__::Error> {
11299 match self {
11300 Self::Value(value) => ::serde::Serialize::serialize(value, serializer),
11301 Self::Lookup(value) => ::serde::Serialize::serialize(value, serializer),
11302 }
11303 }
11304}
11305
11306impl<'de> ::serde::Deserialize<'de> for TermsQueryField {
11307 fn deserialize<D__: ::serde::Deserializer<'de>>(
11308 deserializer: D__,
11309 ) -> ::core::result::Result<Self, D__::Error> {
11310 struct Shape;
11311 impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
11312 type Value = TermsQueryField;
11313 const EXPECTING: &'static str = "TermsQueryField: array or object";
11314 fn visit<V__: ::serde::Deserializer<'de>>(
11315 self,
11316 kind: ::oxsearch_core::__private::Kind,
11317 value: V__,
11318 ) -> ::core::result::Result<Self::Value, V__::Error> {
11319 match kind {
11320 ::oxsearch_core::__private::Kind::Array => {
11321 <::std::vec::Vec<crate::FieldValue> as ::serde::Deserialize>::deserialize(
11322 value,
11323 )
11324 .map(TermsQueryField::Value)
11325 }
11326 ::oxsearch_core::__private::Kind::Object => {
11327 <crate::query_dsl::TermsLookup as ::serde::Deserialize>::deserialize(value)
11328 .map(TermsQueryField::Lookup)
11329 }
11330 _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
11331 format_args!("TermsQueryField can't be {kind:?}"),
11332 )),
11333 }
11334 }
11335 }
11336 ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
11337 }
11338}
11339
11340impl ::core::convert::From<::std::vec::Vec<crate::FieldValue>> for TermsQueryField {
11341 fn from(value: ::std::vec::Vec<crate::FieldValue>) -> Self {
11342 Self::Value(value)
11343 }
11344}
11345
11346impl ::core::convert::From<crate::query_dsl::TermsLookup> for TermsQueryField {
11347 fn from(value: crate::query_dsl::TermsLookup) -> Self {
11348 Self::Lookup(value)
11349 }
11350}
11351
11352#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11353#[non_exhaustive]
11354pub struct TermsSetQuery {
11355 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11360 pub boost: ::core::option::Option<f32>,
11361 #[serde(
11362 rename = "_name",
11363 skip_serializing_if = "::core::option::Option::is_none"
11364 )]
11365 pub name: ::core::option::Option<::std::string::String>,
11366 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11368 pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
11369 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11371 pub minimum_should_match_field: ::core::option::Option<crate::Field>,
11372 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11374 pub minimum_should_match_script: ::core::option::Option<crate::Script>,
11375 #[serde(default = "::core::default::Default::default")]
11377 pub terms: ::std::vec::Vec<crate::FieldValue>,
11378}
11379
11380impl TermsSetQuery {
11381 pub fn new(terms: impl ::core::convert::Into<::std::vec::Vec<crate::FieldValue>>) -> Self {
11383 Self {
11384 boost: ::core::option::Option::None,
11385 name: ::core::option::Option::None,
11386 minimum_should_match: ::core::option::Option::None,
11387 minimum_should_match_field: ::core::option::Option::None,
11388 minimum_should_match_script: ::core::option::Option::None,
11389 terms: terms.into(),
11390 }
11391 }
11392}
11393
11394impl TermsSetQuery {
11395 pub fn boost(mut self, value: f32) -> Self {
11397 self.boost = ::core::option::Option::Some(value.into());
11398 self
11399 }
11400 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11402 self.name = ::core::option::Option::Some(value.into());
11403 self
11404 }
11405 pub fn minimum_should_match(
11407 mut self,
11408 value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
11409 ) -> Self {
11410 self.minimum_should_match = ::core::option::Option::Some(value.into());
11411 self
11412 }
11413 pub fn minimum_should_match_field(
11415 mut self,
11416 value: impl ::core::convert::Into<crate::Field>,
11417 ) -> Self {
11418 self.minimum_should_match_field = ::core::option::Option::Some(value.into());
11419 self
11420 }
11421 pub fn minimum_should_match_script(
11423 mut self,
11424 value: impl ::core::convert::Into<crate::Script>,
11425 ) -> Self {
11426 self.minimum_should_match_script = ::core::option::Option::Some(value.into());
11427 self
11428 }
11429}
11430
11431#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11432#[non_exhaustive]
11433pub struct TextExpansionQuery {
11434 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11439 pub boost: ::core::option::Option<f32>,
11440 #[serde(
11441 rename = "_name",
11442 skip_serializing_if = "::core::option::Option::is_none"
11443 )]
11444 pub name: ::core::option::Option<::std::string::String>,
11445 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11447 pub model_id: ::core::option::Option<::std::string::String>,
11448 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11450 pub model_text: ::core::option::Option<::std::string::String>,
11451 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11453 pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
11454}
11455
11456impl TextExpansionQuery {
11457 pub fn new(
11459 model_id: impl ::core::convert::Into<::std::string::String>,
11460 model_text: impl ::core::convert::Into<::std::string::String>,
11461 ) -> Self {
11462 Self {
11463 boost: ::core::option::Option::None,
11464 name: ::core::option::Option::None,
11465 model_id: ::core::option::Option::Some(model_id.into()),
11466 model_text: ::core::option::Option::Some(model_text.into()),
11467 pruning_config: ::core::option::Option::None,
11468 }
11469 }
11470}
11471
11472impl TextExpansionQuery {
11473 pub fn boost(mut self, value: f32) -> Self {
11475 self.boost = ::core::option::Option::Some(value.into());
11476 self
11477 }
11478 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11480 self.name = ::core::option::Option::Some(value.into());
11481 self
11482 }
11483 pub fn pruning_config(
11485 mut self,
11486 value: impl ::core::convert::Into<crate::TokenPruningConfig>,
11487 ) -> Self {
11488 self.pruning_config = ::core::option::Option::Some(value.into());
11489 self
11490 }
11491}
11492
11493#[derive(Clone, Debug, PartialEq, Eq, Hash)]
11494#[non_exhaustive]
11495pub enum TextQueryType {
11496 BestFields,
11498 MostFields,
11500 CrossFields,
11503 Phrase,
11505 PhrasePrefix,
11507 BoolPrefix,
11509 Raw(::std::string::String),
11511}
11512
11513impl TextQueryType {
11514 pub fn as_str(&self) -> &str {
11516 match self {
11517 Self::BestFields => "best_fields",
11518 Self::MostFields => "most_fields",
11519 Self::CrossFields => "cross_fields",
11520 Self::Phrase => "phrase",
11521 Self::PhrasePrefix => "phrase_prefix",
11522 Self::BoolPrefix => "bool_prefix",
11523 Self::Raw(value) => value,
11524 }
11525 }
11526
11527 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
11529 match value {
11530 "best_fields" => ::core::option::Option::Some(Self::BestFields),
11531 "most_fields" => ::core::option::Option::Some(Self::MostFields),
11532 "cross_fields" => ::core::option::Option::Some(Self::CrossFields),
11533 "phrase" => ::core::option::Option::Some(Self::Phrase),
11534 "phrase_prefix" => ::core::option::Option::Some(Self::PhrasePrefix),
11535 "bool_prefix" => ::core::option::Option::Some(Self::BoolPrefix),
11536 _ => ::core::option::Option::None,
11537 }
11538 }
11539}
11540
11541impl ::serde::Serialize for TextQueryType {
11542 fn serialize<S__: ::serde::Serializer>(
11543 &self,
11544 serializer: S__,
11545 ) -> ::core::result::Result<S__::Ok, S__::Error> {
11546 serializer.serialize_str(self.as_str())
11547 }
11548}
11549
11550impl<'de> ::serde::Deserialize<'de> for TextQueryType {
11551 fn deserialize<D__: ::serde::Deserializer<'de>>(
11552 deserializer: D__,
11553 ) -> ::core::result::Result<Self, D__::Error> {
11554 ::oxsearch_core::__private::deserialize_string_enum(
11555 deserializer,
11556 "TextQueryType",
11557 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
11558 )
11559 }
11560}
11561
11562#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11563#[non_exhaustive]
11564pub struct TypeQuery {
11565 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11570 pub boost: ::core::option::Option<f32>,
11571 #[serde(
11572 rename = "_name",
11573 skip_serializing_if = "::core::option::Option::is_none"
11574 )]
11575 pub name: ::core::option::Option<::std::string::String>,
11576 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11577 pub value: ::core::option::Option<::std::string::String>,
11578}
11579
11580impl TypeQuery {
11581 pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
11583 Self {
11584 boost: ::core::option::Option::None,
11585 name: ::core::option::Option::None,
11586 value: ::core::option::Option::Some(value.into()),
11587 }
11588 }
11589}
11590
11591impl TypeQuery {
11592 pub fn boost(mut self, value: f32) -> Self {
11594 self.boost = ::core::option::Option::Some(value.into());
11595 self
11596 }
11597 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11599 self.name = ::core::option::Option::Some(value.into());
11600 self
11601 }
11602}
11603
11604#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11605#[serde(
11606 try_from = "UntypedDecayFunctionRepr",
11607 into = "UntypedDecayFunctionRepr"
11608)]
11609#[non_exhaustive]
11610pub struct UntypedDecayFunction {
11611 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11613 pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
11614 pub field: crate::Field,
11616 pub placement: crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
11618}
11619
11620impl UntypedDecayFunction {
11621 pub fn new(
11623 field: impl ::core::convert::Into<crate::Field>,
11624 placement: impl ::core::convert::Into<
11625 crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
11626 >,
11627 ) -> Self {
11628 Self {
11629 multi_value_mode: ::core::option::Option::None,
11630 field: field.into(),
11631 placement: placement.into(),
11632 }
11633 }
11634}
11635
11636impl UntypedDecayFunction {
11637 pub fn multi_value_mode(
11639 mut self,
11640 value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
11641 ) -> Self {
11642 self.multi_value_mode = ::core::option::Option::Some(value.into());
11643 self
11644 }
11645}
11646
11647#[derive(::serde::Serialize, ::serde::Deserialize)]
11648struct UntypedDecayFunctionRepr {
11649 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11651 multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
11652 #[serde(flatten)]
11653 keyed__: ::indexmap::IndexMap<
11654 crate::Field,
11655 crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
11656 >,
11657}
11658
11659impl ::core::convert::TryFrom<UntypedDecayFunctionRepr> for UntypedDecayFunction {
11660 type Error = ::std::string::String;
11661 fn try_from(repr: UntypedDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
11662 let mut keyed = repr.keyed__.into_iter();
11663 match (keyed.next(), keyed.next()) {
11664 (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
11665 ::core::result::Result::Ok(Self {
11666 multi_value_mode: repr.multi_value_mode,
11667 field,
11668 placement,
11669 })
11670 }
11671 _ => ::core::result::Result::Err(::std::string::String::from(
11672 "UntypedDecayFunction needs exactly one property keyed by its field",
11673 )),
11674 }
11675 }
11676}
11677
11678impl ::core::convert::From<UntypedDecayFunction> for UntypedDecayFunctionRepr {
11679 fn from(value: UntypedDecayFunction) -> Self {
11680 let mut keyed__ = ::indexmap::IndexMap::new();
11681 keyed__.insert(value.field, value.placement);
11682 Self {
11683 multi_value_mode: value.multi_value_mode,
11684 keyed__,
11685 }
11686 }
11687}
11688
11689#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11690#[non_exhaustive]
11691pub struct UntypedDistanceFeatureQuery {
11692 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11697 pub boost: ::core::option::Option<f32>,
11698 #[serde(
11699 rename = "_name",
11700 skip_serializing_if = "::core::option::Option::is_none"
11701 )]
11702 pub name: ::core::option::Option<::std::string::String>,
11703 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11708 pub origin: ::core::option::Option<::serde_json::Value>,
11709 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11712 pub pivot: ::core::option::Option<::serde_json::Value>,
11713 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11718 pub field: ::core::option::Option<crate::Field>,
11719}
11720
11721impl UntypedDistanceFeatureQuery {
11722 pub fn new(
11724 origin: impl ::core::convert::Into<::serde_json::Value>,
11725 pivot: impl ::core::convert::Into<::serde_json::Value>,
11726 field: impl ::core::convert::Into<crate::Field>,
11727 ) -> Self {
11728 Self {
11729 boost: ::core::option::Option::None,
11730 name: ::core::option::Option::None,
11731 origin: ::core::option::Option::Some(origin.into()),
11732 pivot: ::core::option::Option::Some(pivot.into()),
11733 field: ::core::option::Option::Some(field.into()),
11734 }
11735 }
11736}
11737
11738impl UntypedDistanceFeatureQuery {
11739 pub fn boost(mut self, value: f32) -> Self {
11741 self.boost = ::core::option::Option::Some(value.into());
11742 self
11743 }
11744 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11746 self.name = ::core::option::Option::Some(value.into());
11747 self
11748 }
11749}
11750
11751#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11752#[non_exhaustive]
11753pub struct UntypedRangeQuery {
11754 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11759 pub boost: ::core::option::Option<f32>,
11760 #[serde(
11761 rename = "_name",
11762 skip_serializing_if = "::core::option::Option::is_none"
11763 )]
11764 pub name: ::core::option::Option<::std::string::String>,
11765 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11767 pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
11768 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11770 pub gt: ::core::option::Option<::serde_json::Value>,
11771 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11773 pub gte: ::core::option::Option<::serde_json::Value>,
11774 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11776 pub lt: ::core::option::Option<::serde_json::Value>,
11777 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11779 pub lte: ::core::option::Option<::serde_json::Value>,
11780 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11782 pub format: ::core::option::Option<crate::DateFormat>,
11783 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11785 pub time_zone: ::core::option::Option<crate::TimeZone>,
11786}
11787
11788impl UntypedRangeQuery {
11789 pub fn new() -> Self {
11791 Self {
11792 boost: ::core::option::Option::None,
11793 name: ::core::option::Option::None,
11794 relation: ::core::option::Option::None,
11795 gt: ::core::option::Option::None,
11796 gte: ::core::option::Option::None,
11797 lt: ::core::option::Option::None,
11798 lte: ::core::option::Option::None,
11799 format: ::core::option::Option::None,
11800 time_zone: ::core::option::Option::None,
11801 }
11802 }
11803}
11804
11805impl UntypedRangeQuery {
11806 pub fn boost(mut self, value: f32) -> Self {
11808 self.boost = ::core::option::Option::Some(value.into());
11809 self
11810 }
11811 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11813 self.name = ::core::option::Option::Some(value.into());
11814 self
11815 }
11816 pub fn relation(
11818 mut self,
11819 value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
11820 ) -> Self {
11821 self.relation = ::core::option::Option::Some(value.into());
11822 self
11823 }
11824 pub fn gt(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11826 self.gt = ::core::option::Option::Some(value.into());
11827 self
11828 }
11829 pub fn gte(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11831 self.gte = ::core::option::Option::Some(value.into());
11832 self
11833 }
11834 pub fn lt(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11836 self.lt = ::core::option::Option::Some(value.into());
11837 self
11838 }
11839 pub fn lte(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11841 self.lte = ::core::option::Option::Some(value.into());
11842 self
11843 }
11844 pub fn format(mut self, value: impl ::core::convert::Into<crate::DateFormat>) -> Self {
11846 self.format = ::core::option::Option::Some(value.into());
11847 self
11848 }
11849 pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
11851 self.time_zone = ::core::option::Option::Some(value.into());
11852 self
11853 }
11854}
11855
11856#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11857#[non_exhaustive]
11858pub struct WeightedTokensQuery {
11859 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11864 pub boost: ::core::option::Option<f32>,
11865 #[serde(
11866 rename = "_name",
11867 skip_serializing_if = "::core::option::Option::is_none"
11868 )]
11869 pub name: ::core::option::Option<::std::string::String>,
11870 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11872 pub tokens: ::core::option::Option<
11873 ::oxsearch_core::shapes::OneOrMany<::indexmap::IndexMap<::std::string::String, f32>>,
11874 >,
11875 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11877 pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
11878}
11879
11880impl WeightedTokensQuery {
11881 pub fn new(
11883 tokens: impl ::core::convert::Into<
11884 ::oxsearch_core::shapes::OneOrMany<::indexmap::IndexMap<::std::string::String, f32>>,
11885 >,
11886 ) -> Self {
11887 Self {
11888 boost: ::core::option::Option::None,
11889 name: ::core::option::Option::None,
11890 tokens: ::core::option::Option::Some(tokens.into()),
11891 pruning_config: ::core::option::Option::None,
11892 }
11893 }
11894}
11895
11896impl WeightedTokensQuery {
11897 pub fn boost(mut self, value: f32) -> Self {
11899 self.boost = ::core::option::Option::Some(value.into());
11900 self
11901 }
11902 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11904 self.name = ::core::option::Option::Some(value.into());
11905 self
11906 }
11907 pub fn pruning_config(
11909 mut self,
11910 value: impl ::core::convert::Into<crate::TokenPruningConfig>,
11911 ) -> Self {
11912 self.pruning_config = ::core::option::Option::Some(value.into());
11913 self
11914 }
11915}
11916
11917#[derive(Clone, Debug, PartialEq)]
11918#[non_exhaustive]
11919pub struct WildcardQuery {
11920 pub boost: ::core::option::Option<f32>,
11925 pub name: ::core::option::Option<::std::string::String>,
11926 pub case_insensitive: ::core::option::Option<bool>,
11928 pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
11930 pub value: ::core::option::Option<::std::string::String>,
11932 pub wildcard: ::core::option::Option<::std::string::String>,
11934}
11935
11936impl WildcardQuery {
11937 pub fn new() -> Self {
11939 Self {
11940 boost: ::core::option::Option::None,
11941 name: ::core::option::Option::None,
11942 case_insensitive: ::core::option::Option::None,
11943 rewrite: ::core::option::Option::None,
11944 value: ::core::option::Option::None,
11945 wildcard: ::core::option::Option::None,
11946 }
11947 }
11948}
11949
11950impl WildcardQuery {
11951 pub fn boost(mut self, value: f32) -> Self {
11953 self.boost = ::core::option::Option::Some(value.into());
11954 self
11955 }
11956 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11958 self.name = ::core::option::Option::Some(value.into());
11959 self
11960 }
11961 pub fn case_insensitive(mut self, value: bool) -> Self {
11963 self.case_insensitive = ::core::option::Option::Some(value.into());
11964 self
11965 }
11966 pub fn rewrite(
11968 mut self,
11969 value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
11970 ) -> Self {
11971 self.rewrite = ::core::option::Option::Some(value.into());
11972 self
11973 }
11974 pub fn value(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11976 self.value = ::core::option::Option::Some(value.into());
11977 self
11978 }
11979 pub fn wildcard(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11981 self.wildcard = ::core::option::Option::Some(value.into());
11982 self
11983 }
11984}
11985
11986#[derive(::serde::Serialize, ::serde::Deserialize)]
11987#[serde(remote = "WildcardQuery")]
11988struct WildcardQueryDef {
11989 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11994 boost: ::core::option::Option<f32>,
11995 #[serde(
11996 rename = "_name",
11997 skip_serializing_if = "::core::option::Option::is_none"
11998 )]
11999 name: ::core::option::Option<::std::string::String>,
12000 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12002 case_insensitive: ::core::option::Option<bool>,
12003 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12005 rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
12006 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12008 value: ::core::option::Option<::std::string::String>,
12009 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12011 wildcard: ::core::option::Option<::std::string::String>,
12012}
12013
12014impl ::serde::Serialize for WildcardQuery {
12015 fn serialize<S__: ::serde::Serializer>(
12016 &self,
12017 serializer: S__,
12018 ) -> ::core::result::Result<S__::Ok, S__::Error> {
12019 if let (::core::option::Option::Some(short), true) = (
12020 &self.value,
12021 self.boost.is_none()
12022 && self.name.is_none()
12023 && self.case_insensitive.is_none()
12024 && self.rewrite.is_none()
12025 && self.wildcard.is_none(),
12026 ) {
12027 return ::serde::Serialize::serialize(short, serializer);
12028 }
12029 WildcardQueryDef::serialize(self, serializer)
12030 }
12031}
12032
12033impl<'de> ::oxsearch_core::__private::Shorthand<'de> for WildcardQuery {
12034 type Short = ::std::string::String;
12035 fn from_short(short: ::std::string::String) -> Self {
12036 Self {
12037 boost: ::core::option::Option::None,
12038 name: ::core::option::Option::None,
12039 case_insensitive: ::core::option::Option::None,
12040 rewrite: ::core::option::Option::None,
12041 value: ::core::option::Option::Some(short),
12042 wildcard: ::core::option::Option::None,
12043 }
12044 }
12045 fn deserialize_full<D__: ::serde::Deserializer<'de>>(
12046 deserializer: D__,
12047 ) -> ::core::result::Result<Self, D__::Error> {
12048 WildcardQueryDef::deserialize(deserializer)
12049 }
12050}
12051
12052impl<'de> ::serde::Deserialize<'de> for WildcardQuery {
12053 fn deserialize<D__: ::serde::Deserializer<'de>>(
12054 deserializer: D__,
12055 ) -> ::core::result::Result<Self, D__::Error> {
12056 ::oxsearch_core::__private::deserialize_shorthand(deserializer)
12057 }
12058}
12059
12060#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
12061#[non_exhaustive]
12062pub struct WrapperQuery {
12063 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12068 pub boost: ::core::option::Option<f32>,
12069 #[serde(
12070 rename = "_name",
12071 skip_serializing_if = "::core::option::Option::is_none"
12072 )]
12073 pub name: ::core::option::Option<::std::string::String>,
12074 #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12077 pub query: ::core::option::Option<::std::string::String>,
12078}
12079
12080impl WrapperQuery {
12081 pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
12083 Self {
12084 boost: ::core::option::Option::None,
12085 name: ::core::option::Option::None,
12086 query: ::core::option::Option::Some(query.into()),
12087 }
12088 }
12089}
12090
12091impl WrapperQuery {
12092 pub fn boost(mut self, value: f32) -> Self {
12094 self.boost = ::core::option::Option::Some(value.into());
12095 self
12096 }
12097 pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
12099 self.name = ::core::option::Option::Some(value.into());
12100 self
12101 }
12102}
12103
12104#[derive(Clone, Debug, PartialEq, Eq, Hash)]
12105#[non_exhaustive]
12106pub enum ZeroTermsQuery {
12107 All,
12109 None,
12111 Raw(::std::string::String),
12113}
12114
12115impl ZeroTermsQuery {
12116 pub fn as_str(&self) -> &str {
12118 match self {
12119 Self::All => "all",
12120 Self::None => "none",
12121 Self::Raw(value) => value,
12122 }
12123 }
12124
12125 pub fn from_known(value: &str) -> ::core::option::Option<Self> {
12127 match value {
12128 "all" => ::core::option::Option::Some(Self::All),
12129 "none" => ::core::option::Option::Some(Self::None),
12130 _ => ::core::option::Option::None,
12131 }
12132 }
12133}
12134
12135impl ::serde::Serialize for ZeroTermsQuery {
12136 fn serialize<S__: ::serde::Serializer>(
12137 &self,
12138 serializer: S__,
12139 ) -> ::core::result::Result<S__::Ok, S__::Error> {
12140 serializer.serialize_str(self.as_str())
12141 }
12142}
12143
12144impl<'de> ::serde::Deserialize<'de> for ZeroTermsQuery {
12145 fn deserialize<D__: ::serde::Deserializer<'de>>(
12146 deserializer: D__,
12147 ) -> ::core::result::Result<Self, D__::Error> {
12148 ::oxsearch_core::__private::deserialize_string_enum(
12149 deserializer,
12150 "ZeroTermsQuery",
12151 |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
12152 )
12153 }
12154}