Skip to main content

trieve_client/models/
autocomplete_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 AutocompleteReqPayload {
15    /// Set content_only to true to only returning the chunk_html of the chunks. This is useful for when you want to reduce amount of data over the wire for latency improvement (typically 10-50ms). Default is false.
16    #[serde(rename = "content_only", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17    pub content_only: Option<Option<bool>>,
18    /// If specified to true, this will extend the search results to include non-exact prefix matches of the same search_type such that a full page_size of results are returned. Default is false.
19    #[serde(rename = "extend_results", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
20    pub extend_results: Option<Option<bool>>,
21    #[serde(rename = "filters", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22    pub filters: Option<Option<Box<models::ChunkFilter>>>,
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 size is the number of chunks to fetch. This can be used to fetch more than 10 chunks at a time.
26    #[serde(rename = "page_size", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub page_size: Option<Option<i64>>,
28    /// Query is the search query. This can be any string. The query will be used to create an embedding vector and/or SPLADE vector which will be used to find the result set.
29    #[serde(rename = "query")]
30    pub query: String,
31    /// 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.
32    #[serde(rename = "remove_stop_words", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub remove_stop_words: Option<Option<bool>>,
34    /// 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.
35    #[serde(rename = "score_threshold", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub score_threshold: Option<Option<f32>>,
37    #[serde(rename = "search_type")]
38    pub search_type: models::SearchMethod,
39    /// 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 (typically 10-50ms). Default is false.
40    #[serde(rename = "slim_chunks", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
41    pub slim_chunks: Option<Option<bool>>,
42    #[serde(rename = "sort_options", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub sort_options: Option<Option<Box<models::SortOptions>>>,
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    /// 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 AutocompleteReqPayload {
53    pub fn new(query: String, search_type: models::SearchMethod) -> AutocompleteReqPayload {
54        AutocompleteReqPayload {
55            content_only: None,
56            extend_results: None,
57            filters: None,
58            highlight_options: None,
59            page_size: None,
60            query,
61            remove_stop_words: None,
62            score_threshold: None,
63            search_type,
64            slim_chunks: None,
65            sort_options: None,
66            use_quote_negated_terms: None,
67            user_id: None,
68        }
69    }
70}
71