class

Kamil::Persistence::SqliteStore

Inherits Kamil::Persistence::IndexStore < Reference < Object

[FUNC-002] [TECH-002] High-Concurrency SQLite WAL Index Store High-concurrency SQLite WAL index store with FTS5 full-text inverted search capabilities.

Constructors

new(connection_url_or_path : String | Path = "sqlite3://kamil.db")

Initializes the SQLite database connection, sets WAL pragmas, and provisions DDL tables, indexes, and triggers.

Source

Instance methods

all_paths

Returns all document paths stored in the pages table.

Source
close

Closes the underlying database connection handle.

Source
count_pages

Returns the total number of records currently stored in the pages table.

Source
delete_index(relative_path : String) : Nil

Removes a document record from the pages table by relative file path.

Source
execute_scalar(query : String) : DB::Any

Executes a scalar SQL query and returns the single resulting value.

Source
get_document(relative_path : String) : Kamil::Document | Nil

Retrieves a fully reconstituted Document entity from the database by its relative path.

Source
list_published

Lists all published documents, including scheduled documents whose published_at date is in the past.

Source
search(query : String, limit : Int32 = 10) : Array(Kamil::DocumentMeta)

Executes a BM25 relevance-ranked full-text search query across pages_fts with syntax sanitization.

Source
search_with_snippets(query : String, limit : Int32 = 10) : Array(NamedTuple(path: String, meta: Kamil::DocumentMeta, snippet: String))

Executes a BM25 relevance-ranked search query and returns document metadata alongside highlighted snippets.

Source
table_exists?(table_name : String) : Bool

Checks whether a given table or view exists in sqlite_master.

Source
upsert_index(doc : Kamil::Document) : Nil

Inserts or updates a document record in the pages table using ANSI UPSERT to fire FTS5 update triggers.

Source