hotdata 0.20.0

Powerful data platform API for datasets, queries, and analytics.
Documentation
/*
 * Hotdata API
 *
 * Powerful data platform API for instant databases, queries, and analytics.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: developers@hotdata.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// IndexEntryResponse : One index in a cross-table listing: the index itself plus the connection, schema, and table it belongs to.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct IndexEntryResponse {
    /// How this vector index organises the vectors it searches: `hnsw` or `ivf`. Absent for BM25 and sorted indexes.
    #[serde(rename = "algorithm", skip_serializing_if = "Option::is_none")]
    pub algorithm: Option<String>,
    #[serde(rename = "columns")]
    pub columns: Vec<String>,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "index_name")]
    pub index_name: String,
    #[serde(rename = "index_type")]
    pub index_type: String,
    /// Distance metric this index was built with. Only present for vector indexes.
    #[serde(rename = "metric", skip_serializing_if = "Option::is_none")]
    pub metric: Option<String>,
    /// Number of clusters an `ivf` index was built with. This can be smaller than the `nlist` requested when the index was created, because the number is capped by how many vectors the clusters were fitted to. Absent for every other kind of index.
    #[serde(rename = "nlist", skip_serializing_if = "Option::is_none")]
    pub nlist: Option<i64>,
    /// How much of an `ivf` index a search reads, as a fraction greater than 0 and at most 1, when the index was created with one. When absent, the server chooses how much each search reads: a width measured on this index's own data when it was built, scaled to the number of results a search asks for, or a server default when no measurement could be made. Absent for every other kind of index.
    #[serde(rename = "probe_fraction", skip_serializing_if = "Option::is_none")]
    pub probe_fraction: Option<f64>,
    /// Source text column for an embedding-backed vector index. A query searches it via `vector_distance(<source_column>, …)`; the indexed `columns` hold the generated embedding column instead. Absent for BM25, sorted, and direct (existing-column) vector indexes.
    #[serde(rename = "source_column", skip_serializing_if = "Option::is_none")]
    pub source_column: Option<String>,
    #[serde(rename = "status")]
    pub status: models::IndexStatus,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    /// How precisely this vector index stores each number of a vector. Always present for an `ivf` index, which stores `int8` unless it was created with another precision. For an `hnsw` index it is present only when the index was created with an explicit precision; absent means it stores at the same precision as the column. Absent for BM25 and sorted indexes.
    #[serde(rename = "vector_precision", skip_serializing_if = "Option::is_none")]
    pub vector_precision: Option<String>,
    #[serde(
        rename = "connection_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub connection_id: Option<Option<String>>,
    #[serde(rename = "schema_name")]
    pub schema_name: String,
    #[serde(rename = "table_name")]
    pub table_name: String,
}

impl IndexEntryResponse {
    /// One index in a cross-table listing: the index itself plus the connection, schema, and table it belongs to.
    pub fn new(
        columns: Vec<String>,
        created_at: String,
        index_name: String,
        index_type: String,
        status: models::IndexStatus,
        updated_at: String,
        schema_name: String,
        table_name: String,
    ) -> IndexEntryResponse {
        IndexEntryResponse {
            algorithm: None,
            columns,
            created_at,
            index_name,
            index_type,
            metric: None,
            nlist: None,
            probe_fraction: None,
            source_column: None,
            status,
            updated_at,
            vector_precision: None,
            connection_id: None,
            schema_name,
            table_name,
        }
    }
}