Skip to main content

SqliteStore

Struct SqliteStore 

Source
pub struct SqliteStore { /* private fields */ }

Implementations§

Source§

impl SqliteStore

Source

pub fn open(path: &Path) -> Result<Self>

Source

pub fn open_in_memory() -> Result<Self>

Trait Implementations§

Source§

impl IndexStore for SqliteStore

Source§

fn insert_paper(&self, paper: &Paper) -> Result<()>

Source§

fn get_paper(&self, id: &str) -> Result<Option<Paper>>

Source§

fn find_paper_by_doi(&self, doi: &str) -> Result<Option<Paper>>

Look up a paper by its DOI (exact match). Used by the import pipeline to skip records that are already in the library.
Source§

fn find_paper_by_openalex_id(&self, openalex_id: &str) -> Result<Option<Paper>>

Look up a paper by its OpenAlex work id (W…). Used by the reference graph to dedupe hydrated referenced papers on re-runs.
Source§

fn find_paper_by_pdf_path(&self, path: &str) -> Result<Option<Paper>>

Look up a paper by its stored source PDF path. Second identity key: the same file re-ingested must not become a second row.
Source§

fn find_paper_by_title(&self, title: &str) -> Result<Option<Paper>>

Look up a paper by title, compared in normalized form (crate::domain::paper::normalize_title). Last identity key, for papers carrying neither a DOI nor a pdf_path. title must already be normalized.
Source§

fn set_paper_body(&self, paper_id: &str, body: &str) -> Result<()>

Store (or replace) the extracted full body text of a paper. Kept out of the Paper domain type so MCP/tool responses never carry megabytes of body text.
Source§

fn get_paper_body(&self, paper_id: &str) -> Result<Option<String>>

Fetch the stored body text of a paper, if any.
Source§

fn set_paper_pdf_path(&self, paper_id: &str, path: &str) -> Result<()>

Record where the paper’s PDF lives on disk (a locally ingested file or a downloaded arXiv PDF), so reingest can re-extract without redownloading.
Source§

fn set_paper_keywords(&self, id: &str, keywords: &str) -> Result<()>

Store the search-only keywords for a paper (LLM- or agent-generated). Overwrites any previous value; the FTS update trigger reindexes the row.
Source§

fn papers_missing_keywords(&self, limit: usize) -> Result<Vec<Paper>>

Papers that have no keywords yet — the enrichment work queue.
Source§

fn papers_missing_keywords_by_topic( &self, topic_id: &str, limit: usize, ) -> Result<Vec<Paper>>

Same, scoped to one topic. The keywords = '' filter lives in SQL so a window full of already-enriched papers cannot hide the ones that need work.
Source§

fn papers_stalest(&self, limit: usize) -> Result<Vec<Paper>>

Papers ordered oldest-update first — the re-enrichment queue, so repeated --force runs advance through the library instead of repeating its head.
Source§

fn papers_by_topic_stalest( &self, topic_id: &str, limit: usize, ) -> Result<Vec<Paper>>

Same, scoped to one topic.
Source§

fn update_paper_status(&self, id: &str, status: PaperStatus) -> Result<()>

Source§

fn update_reading_status(&self, id: &str, status: ReadingStatus) -> Result<()>

Source§

fn update_rating(&self, id: &str, rating: Rating) -> Result<()>

Source§

fn clear_rating(&self, id: &str) -> Result<()>

Source§

fn search_papers(&self, query: &str, limit: usize) -> Result<Vec<Paper>>

Source§

fn search_body_evidence( &self, query: &str, paper_id: Option<&str>, limit: usize, ) -> Result<Vec<BodyEvidence>>

Body-text matches for query, each carrying the matching snippet and where in the document it sits. Papers whose body is not stored (no PDF ingest) cannot match. paper_id scopes the search to one paper; without it the whole library is searched.
Source§

fn list_papers(&self, limit: Option<usize>) -> Result<Vec<Paper>>

Source§

fn list_papers_by_topic( &self, topic_id: &str, limit: Option<usize>, ) -> Result<Vec<Paper>>

Papers explicitly linked to topic_id via topic_papers, most relevant first. Used so analysis/report builders scope LLM context to the requested topic rather than arbitrary recent papers.
Source§

fn insert_topic(&self, topic: &ResearchTopic) -> Result<()>

Source§

fn get_topic(&self, id: &str) -> Result<Option<ResearchTopic>>

Source§

fn list_topics(&self) -> Result<Vec<ResearchTopic>>

Source§

fn insert_gap(&self, gap: &KnowledgeGap) -> Result<()>

Source§

fn list_gaps(&self, topic_id: Option<&str>) -> Result<Vec<KnowledgeGap>>

Source§

fn get_research_state(&self, topic_id: &str) -> Result<Option<ResearchState>>

Source§

fn update_research_state(&self, state: &ResearchState) -> Result<()>

Source§

fn insert_report(&self, report: &ResearchReport) -> Result<()>

Source§

fn list_reports(&self, limit: Option<usize>) -> Result<Vec<ResearchReport>>

Source§

fn insert_citations(&self, citations: &[Citation]) -> Result<usize>

Insert citation edges, skipping pairs already stored. Returns how many were newly inserted.
Source§

fn citations_for_paper(&self, paper_id: &str) -> Result<Vec<Citation>>

Reference edges originating from paper_id, insertion order.
Source§

fn citations_citing_paper(&self, paper_id: &str) -> Result<Vec<Citation>>

Citation edges pointing at paper_id (works citing it), insertion order.
Source§

fn set_citation_contexts(&self, citations: &[Citation]) -> Result<usize>

Set the context label on existing citation edges. Pairs with no stored edge are ignored. Returns how many rows changed.
Source§

fn rebuild_index(&self) -> Result<()>

Source§

fn init_schema(&self) -> Result<()>

Auto Trait Implementations§

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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