trieve-client 0.11.7

Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
Documentation
/*
 * Trieve API
 *
 * Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
 *
 * The version of the OpenAPI document: 0.11.7
 * Contact: developers@trieve.ai
 * Generated by: https://openapi-generator.tech
 */

use crate::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SearchOverGroupsReqPayload {
    #[serde(rename = "filters", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub filters: Option<Option<Box<models::ChunkFilter>>>,
    /// Get total page count for the query accounting for the applied filters. Defaults to false, but can be set to true when the latency penalty is acceptable (typically 50-200ms).
    #[serde(rename = "get_total_pages", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub get_total_pages: Option<Option<bool>>,
    /// Group_size is the number of chunks to fetch for each group. The default is 3. If a group has less than group_size chunks, all chunks will be returned. If this is set to a large number, we recommend setting slim_chunks to true to avoid returning the content and chunk_html of the chunks so as to lower the amount of time required for content download and serialization.
    #[serde(rename = "group_size", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub group_size: Option<Option<i32>>,
    #[serde(rename = "highlight_options", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub highlight_options: Option<Option<Box<models::HighlightOptions>>>,
    /// Page of group results to fetch. Page is 1-indexed.
    #[serde(rename = "page", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub page: Option<Option<i64>>,
    /// Page size is the number of group results to fetch. The default is 10.
    #[serde(rename = "page_size", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub page_size: Option<Option<i64>>,
    #[serde(rename = "query")]
    pub query: Box<models::QueryTypes>,
    /// If true, stop words (specified in server/src/stop-words.txt in the git repo) will be removed. Queries that are entirely stop words will be preserved.
    #[serde(rename = "remove_stop_words", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub remove_stop_words: Option<Option<bool>>,
    /// Set score_threshold to a float to filter out chunks with a score below the threshold. This threshold applies before weight and bias modifications. If not specified, this defaults to 0.0.
    #[serde(rename = "score_threshold", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub score_threshold: Option<Option<f32>>,
    #[serde(rename = "search_type")]
    pub search_type: models::SearchMethod,
    /// Set slim_chunks to true to avoid returning the content and chunk_html of the chunks. This is useful for when you want to reduce amount of data over the wire for latency improvement (typicall 10-50ms). Default is false.
    #[serde(rename = "slim_chunks", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub slim_chunks: Option<Option<bool>>,
    /// If true, quoted and - prefixed words will be parsed from the queries and used as required and negated words respectively. Default is false.
    #[serde(rename = "use_quote_negated_terms", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub use_quote_negated_terms: Option<Option<bool>>,
    /// The user_id is the id of the user who is making the request. This is used to track user interactions with the search results.
    #[serde(rename = "user_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub user_id: Option<Option<String>>,
}

impl SearchOverGroupsReqPayload {
    pub fn new(query: models::QueryTypes, search_type: models::SearchMethod) -> SearchOverGroupsReqPayload {
        SearchOverGroupsReqPayload {
            filters: None,
            get_total_pages: None,
            group_size: None,
            highlight_options: None,
            page: None,
            page_size: None,
            query: Box::new(query),
            remove_stop_words: None,
            score_threshold: None,
            search_type,
            slim_chunks: None,
            use_quote_negated_terms: None,
            user_id: None,
        }
    }
}