trieve_client/models/
count_chunks_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 CountChunksReqPayload {
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    /// Set limit to restrict the maximum number of chunks to count. This is useful for when you want to reduce the latency of the count operation. By default the limit will be the number of chunks in the dataset.
18    #[serde(rename = "limit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub limit: Option<Option<i64>>,
20    #[serde(rename = "query")]
21    pub query: Box<models::QueryTypes>,
22    /// 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.
23    #[serde(rename = "score_threshold", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub score_threshold: Option<Option<f32>>,
25    #[serde(rename = "search_type")]
26    pub search_type: models::CountSearchMethod,
27    /// If true, quoted and - prefixed words will be parsed from the queries and used as required and negated words respectively. Default is false.
28    #[serde(rename = "use_quote_negated_terms", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub use_quote_negated_terms: Option<Option<bool>>,
30}
31
32impl CountChunksReqPayload {
33    pub fn new(query: models::QueryTypes, search_type: models::CountSearchMethod) -> CountChunksReqPayload {
34        CountChunksReqPayload {
35            filters: None,
36            limit: None,
37            query: Box::new(query),
38            score_threshold: None,
39            search_type,
40            use_quote_negated_terms: None,
41        }
42    }
43}
44