#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct ChunkRescorerChunkingSettings {
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub max_chunk_size: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub overlap: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub sentence_overlap: ::core::option::Option<i32>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub separator_group: ::core::option::Option<::std::string::String>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub separators: ::core::option::Option<::std::vec::Vec<::std::string::String>>,
#[serde(skip_serializing_if = "::core::option::Option::is_none")]
pub strategy: ::core::option::Option<::std::string::String>,
}
impl ChunkRescorerChunkingSettings {
pub fn new(max_chunk_size: i32) -> Self {
Self {
max_chunk_size: ::core::option::Option::Some(max_chunk_size.into()),
overlap: ::core::option::Option::None,
sentence_overlap: ::core::option::Option::None,
separator_group: ::core::option::Option::None,
separators: ::core::option::Option::None,
strategy: ::core::option::Option::None,
}
}
}
impl ChunkRescorerChunkingSettings {
pub fn overlap(mut self, value: i32) -> Self {
self.overlap = ::core::option::Option::Some(value.into());
self
}
pub fn sentence_overlap(mut self, value: i32) -> Self {
self.sentence_overlap = ::core::option::Option::Some(value.into());
self
}
pub fn separator_group(
mut self,
value: impl ::core::convert::Into<::std::string::String>,
) -> Self {
self.separator_group = ::core::option::Option::Some(value.into());
self
}
pub fn separators(
mut self,
value: impl ::core::convert::Into<::std::vec::Vec<::std::string::String>>,
) -> Self {
self.separators = ::core::option::Option::Some(value.into());
self
}
pub fn strategy(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
self.strategy = ::core::option::Option::Some(value.into());
self
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FieldType {
None,
GeoPoint,
GeoShape,
Ip,
Binary,
Keyword,
Text,
SearchAsYouType,
Wildcard,
Date,
DateNanos,
Boolean,
Completion,
Nested,
Object,
Passthrough,
Version,
Murmur3,
TokenCount,
Percolator,
Integer,
Long,
Short,
Byte,
Float,
HalfFloat,
ScaledFloat,
Double,
IntegerRange,
FloatRange,
LongRange,
DoubleRange,
DateRange,
IpRange,
Alias,
Join,
RankFeature,
RankFeatures,
Flattened,
Shape,
Histogram,
ConstantKeyword,
CountedKeyword,
AggregateMetricDouble,
DenseVector,
SemanticText,
SparseVector,
MatchOnlyText,
IcuCollationKeyword,
Raw(::std::string::String),
}
impl FieldType {
pub fn as_str(&self) -> &str {
match self {
Self::None => "none",
Self::GeoPoint => "geo_point",
Self::GeoShape => "geo_shape",
Self::Ip => "ip",
Self::Binary => "binary",
Self::Keyword => "keyword",
Self::Text => "text",
Self::SearchAsYouType => "search_as_you_type",
Self::Wildcard => "wildcard",
Self::Date => "date",
Self::DateNanos => "date_nanos",
Self::Boolean => "boolean",
Self::Completion => "completion",
Self::Nested => "nested",
Self::Object => "object",
Self::Passthrough => "passthrough",
Self::Version => "version",
Self::Murmur3 => "murmur3",
Self::TokenCount => "token_count",
Self::Percolator => "percolator",
Self::Integer => "integer",
Self::Long => "long",
Self::Short => "short",
Self::Byte => "byte",
Self::Float => "float",
Self::HalfFloat => "half_float",
Self::ScaledFloat => "scaled_float",
Self::Double => "double",
Self::IntegerRange => "integer_range",
Self::FloatRange => "float_range",
Self::LongRange => "long_range",
Self::DoubleRange => "double_range",
Self::DateRange => "date_range",
Self::IpRange => "ip_range",
Self::Alias => "alias",
Self::Join => "join",
Self::RankFeature => "rank_feature",
Self::RankFeatures => "rank_features",
Self::Flattened => "flattened",
Self::Shape => "shape",
Self::Histogram => "histogram",
Self::ConstantKeyword => "constant_keyword",
Self::CountedKeyword => "counted_keyword",
Self::AggregateMetricDouble => "aggregate_metric_double",
Self::DenseVector => "dense_vector",
Self::SemanticText => "semantic_text",
Self::SparseVector => "sparse_vector",
Self::MatchOnlyText => "match_only_text",
Self::IcuCollationKeyword => "icu_collation_keyword",
Self::Raw(value) => value,
}
}
pub fn from_known(value: &str) -> ::core::option::Option<Self> {
match value {
"none" => ::core::option::Option::Some(Self::None),
"geo_point" => ::core::option::Option::Some(Self::GeoPoint),
"geo_shape" => ::core::option::Option::Some(Self::GeoShape),
"ip" => ::core::option::Option::Some(Self::Ip),
"binary" => ::core::option::Option::Some(Self::Binary),
"keyword" => ::core::option::Option::Some(Self::Keyword),
"text" => ::core::option::Option::Some(Self::Text),
"search_as_you_type" => ::core::option::Option::Some(Self::SearchAsYouType),
"wildcard" => ::core::option::Option::Some(Self::Wildcard),
"date" => ::core::option::Option::Some(Self::Date),
"date_nanos" => ::core::option::Option::Some(Self::DateNanos),
"boolean" => ::core::option::Option::Some(Self::Boolean),
"completion" => ::core::option::Option::Some(Self::Completion),
"nested" => ::core::option::Option::Some(Self::Nested),
"object" => ::core::option::Option::Some(Self::Object),
"passthrough" => ::core::option::Option::Some(Self::Passthrough),
"version" => ::core::option::Option::Some(Self::Version),
"murmur3" => ::core::option::Option::Some(Self::Murmur3),
"token_count" => ::core::option::Option::Some(Self::TokenCount),
"percolator" => ::core::option::Option::Some(Self::Percolator),
"integer" => ::core::option::Option::Some(Self::Integer),
"long" => ::core::option::Option::Some(Self::Long),
"short" => ::core::option::Option::Some(Self::Short),
"byte" => ::core::option::Option::Some(Self::Byte),
"float" => ::core::option::Option::Some(Self::Float),
"half_float" => ::core::option::Option::Some(Self::HalfFloat),
"scaled_float" => ::core::option::Option::Some(Self::ScaledFloat),
"double" => ::core::option::Option::Some(Self::Double),
"integer_range" => ::core::option::Option::Some(Self::IntegerRange),
"float_range" => ::core::option::Option::Some(Self::FloatRange),
"long_range" => ::core::option::Option::Some(Self::LongRange),
"double_range" => ::core::option::Option::Some(Self::DoubleRange),
"date_range" => ::core::option::Option::Some(Self::DateRange),
"ip_range" => ::core::option::Option::Some(Self::IpRange),
"alias" => ::core::option::Option::Some(Self::Alias),
"join" => ::core::option::Option::Some(Self::Join),
"rank_feature" => ::core::option::Option::Some(Self::RankFeature),
"rank_features" => ::core::option::Option::Some(Self::RankFeatures),
"flattened" => ::core::option::Option::Some(Self::Flattened),
"shape" => ::core::option::Option::Some(Self::Shape),
"histogram" => ::core::option::Option::Some(Self::Histogram),
"constant_keyword" => ::core::option::Option::Some(Self::ConstantKeyword),
"counted_keyword" => ::core::option::Option::Some(Self::CountedKeyword),
"aggregate_metric_double" => ::core::option::Option::Some(Self::AggregateMetricDouble),
"dense_vector" => ::core::option::Option::Some(Self::DenseVector),
"semantic_text" => ::core::option::Option::Some(Self::SemanticText),
"sparse_vector" => ::core::option::Option::Some(Self::SparseVector),
"match_only_text" => ::core::option::Option::Some(Self::MatchOnlyText),
"icu_collation_keyword" => ::core::option::Option::Some(Self::IcuCollationKeyword),
_ => ::core::option::Option::None,
}
}
}
impl ::serde::Serialize for FieldType {
fn serialize<S__: ::serde::Serializer>(
&self,
serializer: S__,
) -> ::core::result::Result<S__::Ok, S__::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> ::serde::Deserialize<'de> for FieldType {
fn deserialize<D__: ::serde::Deserializer<'de>>(
deserializer: D__,
) -> ::core::result::Result<Self, D__::Error> {
::oxsearch_core::__private::deserialize_string_enum(deserializer, "FieldType", |value| {
Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
})
}
}