typesense-rs 27.0.1

An open source search engine for building delightful search experiences.
Documentation
// Typesense API
//
// An open source search engine for building delightful search experiences.
//
// The version of the OpenAPI document: 27.0
//
// Generated by: https://openapi-generator.tech

use serde::{Deserialize, Serialize};

use crate::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CollectionSchema {
	/// The name of an int32 / float field that determines the order in which
	/// the search results are ranked when a sort_by clause is not provided
	/// during searching. This field must indicate some kind of popularity.
	#[serde(rename = "default_sorting_field", skip_serializing_if = "Option::is_none")]
	pub default_sorting_field: Option<String>,
	/// Enables experimental support at a collection level for nested object or
	/// object array fields. This field is only available if the Typesense
	/// server is version `0.24.0.rcn34` or later.
	#[serde(rename = "enable_nested_fields", skip_serializing_if = "Option::is_none")]
	pub enable_nested_fields: Option<bool>,
	/// A list of fields for querying, filtering and faceting
	#[serde(rename = "fields")]
	pub fields: Vec<models::Field>,
	/// Name of the collection
	#[serde(rename = "name")]
	pub name: String,
	/// List of symbols or special characters to be indexed.
	#[serde(rename = "symbols_to_index", skip_serializing_if = "Option::is_none")]
	pub symbols_to_index: Option<Vec<String>>,
	/// List of symbols or special characters to be used for splitting the text
	/// into individual words in addition to space and new-line characters.
	#[serde(rename = "token_separators", skip_serializing_if = "Option::is_none")]
	pub token_separators: Option<Vec<String>>,
	#[serde(rename = "voice_query_model", skip_serializing_if = "Option::is_none")]
	pub voice_query_model: Option<Box<models::VoiceQueryModelCollectionConfig>>,
}

impl CollectionSchema {
	pub fn new(fields: Vec<models::Field>, name: String) -> CollectionSchema {
		CollectionSchema {
			default_sorting_field: None,
			enable_nested_fields: None,
			fields,
			name,
			symbols_to_index: None,
			token_separators: None,
			voice_query_model: None,
		}
	}
}