manticoresearch 2.0.0

Сlient for Manticore Search.
Documentation
/*
 * Manticore Search Client
 *
 * Сlient for Manticore Search. 
 *
 * The version of the OpenAPI document: 5.0.0
 * Contact: info@manticoresearch.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Highlight {
    /// Maximum size of the text fragments in highlighted snippets per field
    #[serde(rename = "fragment_size", skip_serializing_if = "Option::is_none")]
    pub fragment_size: Option<i32>,
    /// Maximum size of snippets per field
    #[serde(rename = "limit", skip_serializing_if = "Option::is_none")]
    pub limit: Option<i32>,
    /// Maximum number of snippets per field
    #[serde(rename = "limit_snippets", skip_serializing_if = "Option::is_none")]
    pub limit_snippets: Option<i32>,
    /// Maximum number of words per field
    #[serde(rename = "limit_words", skip_serializing_if = "Option::is_none")]
    pub limit_words: Option<i32>,
    /// Total number of highlighted fragments per field
    #[serde(rename = "number_of_fragments", skip_serializing_if = "Option::is_none")]
    pub number_of_fragments: Option<i32>,
    /// Text inserted after the matched term, typically used for HTML formatting
    #[serde(rename = "after_match", skip_serializing_if = "Option::is_none")]
    pub after_match: Option<String>,
    /// Permits an empty string to be returned as the highlighting result. Otherwise, the beginning of the original text would be returned
    #[serde(rename = "allow_empty", skip_serializing_if = "Option::is_none")]
    pub allow_empty: Option<bool>,
    /// Number of words around the match to include in the highlight
    #[serde(rename = "around", skip_serializing_if = "Option::is_none")]
    pub around: Option<i32>,
    /// Text inserted before the match, typically used for HTML formatting
    #[serde(rename = "before_match", skip_serializing_if = "Option::is_none")]
    pub before_match: Option<String>,
    /// Emits an HTML tag with the enclosing zone name before each highlighted snippet
    #[serde(rename = "emit_zones", skip_serializing_if = "Option::is_none")]
    pub emit_zones: Option<bool>,
    /// If set to 'html', retains HTML markup when highlighting
    #[serde(rename = "encoder", skip_serializing_if = "Option::is_none")]
    pub encoder: Option<Encoder>,
    #[serde(rename = "fields", skip_serializing_if = "Option::is_none")]
    pub fields: Option<Box<models::HighlightFields>>,
    /// Ignores the length limit until the result includes all keywords
    #[serde(rename = "force_all_words", skip_serializing_if = "Option::is_none")]
    pub force_all_words: Option<bool>,
    /// Forces snippet generation even if limits allow highlighting the entire text
    #[serde(rename = "force_snippets", skip_serializing_if = "Option::is_none")]
    pub force_snippets: Option<bool>,
    #[serde(rename = "highlight_query", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub highlight_query: Option<Option<Box<models::QueryFilter>>>,
    /// Defines the mode for handling HTML markup in the highlight
    #[serde(rename = "html_strip_mode", skip_serializing_if = "Option::is_none")]
    pub html_strip_mode: Option<HtmlStripMode>,
    /// Determines whether the 'limit', 'limit_words', and 'limit_snippets' options operate as individual limits in each field of the document
    #[serde(rename = "limits_per_field", skip_serializing_if = "Option::is_none")]
    pub limits_per_field: Option<bool>,
    /// If set to 1, allows an empty string to be returned as a highlighting result
    #[serde(rename = "no_match_size", skip_serializing_if = "Option::is_none")]
    pub no_match_size: Option<NoMatchSize>,
    /// Sets the sorting order of highlighted snippets
    #[serde(rename = "order", skip_serializing_if = "Option::is_none")]
    pub order: Option<Order>,
    /// Text inserted before each highlighted snippet
    #[serde(rename = "pre_tags", skip_serializing_if = "Option::is_none")]
    pub pre_tags: Option<String>,
    /// Text inserted after each highlighted snippet
    #[serde(rename = "post_tags", skip_serializing_if = "Option::is_none")]
    pub post_tags: Option<String>,
    /// Sets the starting value of the %SNIPPET_ID% macro
    #[serde(rename = "start_snippet_id", skip_serializing_if = "Option::is_none")]
    pub start_snippet_id: Option<i32>,
    /// Defines whether to additionally break snippets by phrase boundary characters
    #[serde(rename = "use_boundaries", skip_serializing_if = "Option::is_none")]
    pub use_boundaries: Option<bool>,
}

impl Highlight {
    pub fn new() -> Highlight {
        Highlight {
            fragment_size: None,
            limit: None,
            limit_snippets: None,
            limit_words: None,
            number_of_fragments: None,
            after_match: None,
            allow_empty: None,
            around: None,
            before_match: None,
            emit_zones: None,
            encoder: None,
            fields: None,
            force_all_words: None,
            force_snippets: None,
            highlight_query: None,
            html_strip_mode: None,
            limits_per_field: None,
            no_match_size: None,
            order: None,
            pre_tags: None,
            post_tags: None,
            start_snippet_id: None,
            use_boundaries: None,
        }
    }
}
/// If set to 'html', retains HTML markup when highlighting
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Encoder {
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "html")]
    Html,
}

impl Default for Encoder {
    fn default() -> Encoder {
        Self::Default
    }
}
/// Defines the mode for handling HTML markup in the highlight
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum HtmlStripMode {
    #[serde(rename = "none")]
    None,
    #[serde(rename = "strip")]
    Strip,
    #[serde(rename = "index")]
    Index,
    #[serde(rename = "retain")]
    Retain,
}

impl Default for HtmlStripMode {
    fn default() -> HtmlStripMode {
        Self::None
    }
}
/// If set to 1, allows an empty string to be returned as a highlighting result
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum NoMatchSize {
    #[serde(rename = "0")]
    Variant0,
    #[serde(rename = "1")]
    Variant1,
}

impl Default for NoMatchSize {
    fn default() -> NoMatchSize {
        Self::Variant0
    }
}
/// Sets the sorting order of highlighted snippets
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Order {
    #[serde(rename = "asc")]
    Asc,
    #[serde(rename = "desc")]
    Desc,
    #[serde(rename = "score")]
    Score,
}

impl Default for Order {
    fn default() -> Order {
        Self::Asc
    }
}