opensearch-client 0.3.1

Strongly typed OpenSearch Client
Documentation
/*
 * opensearch-client
 *
 * Rust Client for OpenSearch
 *
 * The version of the OpenAPI document: 3.1.0
 * Contact: alberto.paro@gmail.com
 * Generated by Paro OpenAPI Generator
 */

use crate::common;
use crate::core;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, Serialize, Deserialize)]
pub struct HighlightBase {
    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<core::search::HighlighterType>,
    /// Controls which locale is used to search for sentence and word boundaries.
    /// This parameter takes the form of a language tag, for example, `"en-US"`, `"fr-FR"`, or `"ja-JP"`.
    #[serde(
        rename = "boundary_scanner_locale",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub boundary_scanner_locale: Option<String>,
    /// The size of the highlighted fragment in characters.
    #[serde(
        rename = "fragment_size",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub fragment_size: Option<u32>,
    /// If set to a non-negative value, highlighting stops at this defined maximum limit.
    /// The rest of the text is not processed or highlighted, and no error is returned.
    /// The `max_analyzer_offset` query setting does not override the `index.highlight.max_analyzed_offset` setting, which takes precedence when it is set to a lower value than the query setting.
    #[serde(
        rename = "max_analyzer_offset",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_analyzer_offset: Option<u32>,
    /// The maximum number of fragments to return.
    /// When the number of fragments is set to `0`, no fragments are returned.
    /// Instead, the entirety of a field's contents are highlighted and returned.
    /// This is useful when you need to highlight short texts, such as a title or address, in which fragmentation is not required.
    /// If `number_of_fragments` is set to `0`, the `fragment_size` is ignored.
    #[serde(
        rename = "number_of_fragments",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub number_of_fragments: Option<u32>,
    #[serde(
        rename = "tags_schema",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub tags_schema: Option<String>,
    /// How far to scan for boundary characters.
    #[serde(
        rename = "boundary_max_scan",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub boundary_max_scan: Option<u32>,
    /// When used in conjunction with `pre_tags`, defines the HTML tags to use for the highlighted text.
    /// By default, highlighted text is wrapped in `<em>` and `</em>` tags.
    #[serde(rename = "post_tags", default, skip_serializing_if = "Option::is_none")]
    pub post_tags: Option<Vec<String>>,
    #[serde(
        rename = "highlight_filter",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub highlight_filter: Option<bool>,
    #[serde(
        rename = "fragmenter",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub fragmenter: Option<String>,
    /// A string that contains each boundary character.
    #[serde(
        rename = "boundary_chars",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub boundary_chars: Option<String>,
    /// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.
    #[serde(
        rename = "no_match_size",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub no_match_size: Option<u32>,
    /// By default, only fields that contains a query match are highlighted.
    /// Set to `false` to highlight all fields.
    #[serde(
        rename = "require_field_match",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub require_field_match: Option<bool>,
    #[serde(
        rename = "fragment_offset",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub fragment_offset: Option<u32>,
    #[serde(
        rename = "highlight_query",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub highlight_query: Option<crate::dsl::Query>,
    #[serde(
        rename = "max_fragment_length",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_fragment_length: Option<u32>,
    #[serde(rename = "options", default, skip_serializing_if = "Option::is_none")]
    pub options: Option<serde_json::Value>,
    #[serde(
        rename = "force_source",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub force_source: Option<bool>,
    #[serde(rename = "order", default, skip_serializing_if = "Option::is_none")]
    pub order: Option<String>,
    #[serde(
        rename = "boundary_scanner",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub boundary_scanner: Option<String>,
    /// Controls the number of matching phrases in a document that are considered.
    /// This prevents the `fvh` highlighter from analyzing too many phrases and consuming too much memory.
    /// When using `matched_fields`, phrase-limited phrases per matched field are considered. Raising the limit increases the query time and consumes more memory.
    /// This setting is only supported by the `fvh` highlighter.
    #[serde(
        rename = "phrase_limit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub phrase_limit: Option<u32>,
    /// When used in conjunction with `post_tags`, defines the HTML tags to use for the highlighted text.
    /// By default, highlighted text is wrapped in `<em>` and `</em>` tags.
    #[serde(rename = "pre_tags", default, skip_serializing_if = "Option::is_none")]
    pub pre_tags: Option<Vec<String>>,
}

impl HighlightBase {
    pub fn new() -> HighlightBase {
        HighlightBase {
            r#type: None,
            boundary_scanner_locale: None,
            fragment_size: None,
            max_analyzer_offset: None,
            number_of_fragments: None,
            tags_schema: None,
            boundary_max_scan: None,
            post_tags: None,
            highlight_filter: None,
            fragmenter: None,
            boundary_chars: None,
            no_match_size: None,
            require_field_match: None,
            fragment_offset: None,
            highlight_query: None,
            max_fragment_length: None,
            options: None,
            force_source: None,
            order: None,
            boundary_scanner: None,
            phrase_limit: None,
            pre_tags: None,
        }
    }
}