Expand description
LanceDB implementation of VectorStore.
Re-exportsยง
use arrow_array::Array;๐use arrow_array::ArrayRef;๐use arrow_array::FixedSizeListArray;๐use arrow_array::Float32Array;๐use arrow_array::RecordBatch;๐use arrow_array::RecordBatchIterator;๐use arrow_array::RecordBatchReader;๐use arrow_array::StringArray;๐use arrow_array::UInt8Array;๐use arrow_array::UInt16Array;๐use arrow_array::UInt32Array;๐use arrow_array::UInt64Array;๐use arrow_schema::DataType;๐use arrow_schema::Field;๐use arrow_schema::Schema;๐use async_trait::async_trait;๐use chrono::Utc;๐use futures::TryStreamExt;๐use lancedb::index::Index;๐use lancedb::index::scalar::FtsIndexBuilder;๐use lancedb::index::scalar::FullTextSearchQuery;๐use lancedb::index::vector::IvfPqIndexBuilder;๐use lancedb::query::ExecutableQuery;๐use lancedb::query::QueryBase;๐use lancedb::query::QueryExecutionOptions;๐use lancedb::table::NewColumnTransform;๐use lancedb::table::OptimizeAction;๐use lancedb::table::OptimizeOptions;๐use lancedb::Connection;๐use lancedb::DistanceType;๐use lancedb::Table;๐use lancedb::connect;๐use ragfs_core::Chunk;๐use ragfs_core::ChunkMetadata;๐use ragfs_core::ContentType;๐use ragfs_core::DirectoryScope;๐use ragfs_core::DistanceMetric;๐use ragfs_core::FileRecord;๐use ragfs_core::FileStatus;๐use ragfs_core::SearchFilter;๐use ragfs_core::SearchQuery;๐use ragfs_core::SearchResult;๐use ragfs_core::StoreError;๐use ragfs_core::StoreStats;๐use ragfs_core::VectorStore;๐use std::collections::HashMap;๐use std::collections::HashSet;๐use std::path::Path;๐use std::path::PathBuf;๐use std::sync::Arc;๐use crate::schema::CHUNKS_SCHEMA_VERSION;๐use crate::schema::SCHEMA_SIDECAR_FILENAME;๐use crate::schema::SchemaSidecar;๐use crate::schema::effective_index_revision;๐use crate::schema::missing_media_columns;๐use crate::schema::missing_scope_columns;๐use tokio::sync::RwLock;๐use tracing::debug;๐use tracing::info;๐use tracing::warn;๐use uuid::Uuid;๐
Structsยง
- Lance
Store - LanceDB-based vector store.
Constantsยง
- ANN_
INDEX_ ๐METRIC - Product default search metric (
gte-small). Train IVF-PQ with this so ANN is valid. - CHUNKS_
TABLE ๐ - FILES_
TABLE ๐ - MIN_
ANN_ ๐ROWS - Lance IVF training uses a default sample rate of 256. Below this, stay on exact scan.
Functionsยง
- batch_
to_ ๐chunks - batch_
to_ ๐file_ records - batch_
to_ ๐search_ results - build_
vector_ ๐array - calculate_
dir_ ๐size - Calculate the total size of a directory recursively.
- combine_
predicates ๐ - content_
type_ ๐to_ string - distance_
type_ ๐from_ metric - Map
DistanceMetricto theLanceDBdistance type used at query time. - escape_
like_ ๐literal - Escape
%and_so they are treated as literals inLIKEpatterns. - escape_
sql_ ๐literal - Escape a string for use inside a single-quoted SQL literal.
- file_
date_ ๐filters_ to_ sql - Files-table predicates for source modification time (inclusive).
- filter_
to_ ๐sql - Convert one
SearchFilterinto a chunks-table SQL predicate. - filters_
to_ ๐sql - Combine
SearchQueryfilters into a single SQL predicate, if any. - glob_
to_ ๐regex - Convert a glob (
*,**,?) into an anchored regular expression. - media_
from_ ๐batch - regex_
escape_ ๐char - scope_
prefix_ ๐sql - Pre-filter for directory-scoped search (exact dir, subdirectory, or suffix).
- status_
to_ ๐string - string_
to_ ๐content_ type - string_
to_ ๐status - type_
or_ ๐mime_ sql type:/mime:values may name a content-type alias or a MIME type.