Skip to main content

trieve_client/models/
chunk_filter.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/// ChunkFilter : Filters is a JSON object which can be used to filter chunks. This is useful for when you want to filter chunks by arbitrary metadata. Unlike with tag filtering, there is a performance hit for filtering on metadata.
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ChunkFilter {
16    /// JOSNB prefilter tells the server to perform a full scan over the metadata JSONB column instead of using the filtered HNSW. Datasets on the enterprise plan with custom metadata indices will perform better with the filtered HNSW instead. When false, the server will use the filtered HNSW index to filter chunks. When true, the server will perform a full scan over the metadata JSONB column to filter chunks. Default is true.
17    #[serde(rename = "jsonb_prefilter", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
18    pub jsonb_prefilter: Option<Option<bool>>,
19    /// All of these field conditions have to match for the chunk to be included in the result set.
20    #[serde(rename = "must", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub must: Option<Option<Vec<models::ConditionType>>>,
22    /// None of these field conditions can match for the chunk to be included in the result set.
23    #[serde(rename = "must_not", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub must_not: Option<Option<Vec<models::ConditionType>>>,
25    /// Only one of these field conditions has to match for the chunk to be included in the result set.
26    #[serde(rename = "should", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub should: Option<Option<Vec<models::ConditionType>>>,
28}
29
30impl ChunkFilter {
31    /// Filters is a JSON object which can be used to filter chunks. This is useful for when you want to filter chunks by arbitrary metadata. Unlike with tag filtering, there is a performance hit for filtering on metadata.
32    pub fn new() -> ChunkFilter {
33        ChunkFilter {
34            jsonb_prefilter: None,
35            must: None,
36            must_not: None,
37            should: None,
38        }
39    }
40}
41