Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }
Expand description

Handle to the search database.

Implementations§

Source§

impl Store

Source

pub fn open_for_build(db_path: &Path) -> Result<Self, RepographError>

Open the index for building, creating the file and schema if absent. A schema-version mismatch wipes and recreates all tables.

§Errors

Returns RepographError::Index on any SQLite failure.

Source

pub fn open_existing(db_path: &Path) -> Result<Self, RepographError>

Open an existing index read-only. Both callers (search, index_health) only query, so a read-only handle avoids write-lock contention with a concurrent repograph index and works on read-only mounts. Returns RepographError::IndexMissing (exit 3) when the file does not exist, and RepographError::Index (exit 1) when it exists but cannot be opened or is the wrong schema.

§Errors

See above.

Source

pub fn ensure_model(&self, model_id: &str) -> Result<(), RepographError>

If model_id differs from the model recorded in the index, drop every vector so the segment never mixes embedding spaces, then record the new model. Call once before reconciling with an embedder.

§Errors

Returns RepographError::Index on SQLite failure.

Source

pub fn has_vectors(&self) -> Result<bool, RepographError>

Whether any embeddings are stored — drives whether semantic retrieval can run at query time.

§Errors

Returns RepographError::Index on SQLite failure.

Source

pub fn indexed_commits( &self, ) -> Result<HashMap<String, Option<String>>, RepographError>

The per-repo indexed commit recorded at the last build.

§Errors

Returns RepographError::Index on SQLite failure.

Source

pub fn reconcile_repo( &mut self, repo: &str, files: &[TrackedFile], head_commit: Option<&str>, embedder: Option<&mut dyn Embedder>, ) -> Result<RepoStats, RepographError>

Reconcile one repo’s tracked files against the index in a single transaction: re-chunk new/changed files, purge files no longer tracked, and record the indexed commit. When embedder is supplied, changed chunks are embedded and their vectors written; an embed failure for a file degrades that file to lexical-only (logged by the caller).

§Errors

Returns RepographError::Index on SQLite failure.

Source

pub fn search_lexical( &self, query: &str, repos: &[String], pool: usize, ) -> Result<Vec<i64>, RepographError>

Lexical (BM25) candidate chunk ids, best-first. repos (when non-empty) restricts results to those repos. Returns an empty vec when the query yields no usable search tokens.

§Errors

Returns RepographError::Index on SQLite failure.

Source

pub fn search_vectors( &self, query_embedding: &[f32], repos: &[String], pool: usize, ) -> Result<Vec<i64>, RepographError>

Vector (cosine) candidate chunk ids, best-first, computed by brute force over the stored embeddings (optionally restricted to repos).

§Errors

Returns RepographError::Index on SQLite failure.

Source

pub fn fetch_chunks( &self, ids: &[i64], ) -> Result<HashMap<i64, ChunkRow>, RepographError>

Fetch chunk rows for the given ids, keyed by id.

§Errors

Returns RepographError::Index on SQLite failure.

Trait Implementations§

Source§

impl Debug for Store

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl !Sync for Store

§

impl !UnwindSafe for Store

§

impl Send for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more