trieve_client/models/
search_over_groups_req_payload.rs

1/*
2 * Trieve API
3 *
4 * Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5 *
6 * The version of the OpenAPI document: 0.11.7
7 * Contact: developers@trieve.ai
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
14pub struct SearchOverGroupsReqPayload {
15    #[serde(rename = "filters", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
16    pub filters: Option<Option<Box<models::ChunkFilter>>>,
17    /// 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).
18    #[serde(rename = "get_total_pages", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub get_total_pages: Option<Option<bool>>,
20    /// 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.
21    #[serde(rename = "group_size", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub group_size: Option<Option<i32>>,
23    #[serde(rename = "highlight_options", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub highlight_options: Option<Option<Box<models::HighlightOptions>>>,
25    /// Page of group results to fetch. Page is 1-indexed.
26    #[serde(rename = "page", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub page: Option<Option<i64>>,
28    /// Page size is the number of group results to fetch. The default is 10.
29    #[serde(rename = "page_size", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub page_size: Option<Option<i64>>,
31    #[serde(rename = "query")]
32    pub query: Box<models::QueryTypes>,
33    /// 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.
34    #[serde(rename = "remove_stop_words", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub remove_stop_words: Option<Option<bool>>,
36    /// 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.
37    #[serde(rename = "score_threshold", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub score_threshold: Option<Option<f32>>,
39    #[serde(rename = "search_type")]
40    pub search_type: models::SearchMethod,
41    /// 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.
42    #[serde(rename = "slim_chunks", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub slim_chunks: Option<Option<bool>>,
44    /// If true, quoted and - prefixed words will be parsed from the queries and used as required and negated words respectively. Default is false.
45    #[serde(rename = "use_quote_negated_terms", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
46    pub use_quote_negated_terms: Option<Option<bool>>,
47    /// 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.
48    #[serde(rename = "user_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub user_id: Option<Option<String>>,
50}
51
52impl SearchOverGroupsReqPayload {
53    pub fn new(query: models::QueryTypes, search_type: models::SearchMethod) -> SearchOverGroupsReqPayload {
54        SearchOverGroupsReqPayload {
55            filters: None,
56            get_total_pages: None,
57            group_size: None,
58            highlight_options: None,
59            page: None,
60            page_size: None,
61            query: Box::new(query),
62            remove_stop_words: None,
63            score_threshold: None,
64            search_type,
65            slim_chunks: None,
66            use_quote_negated_terms: None,
67            user_id: None,
68        }
69    }
70}
71