Arod_searchFTS5 full-text search index for Arod content.
Uses one FTS5 table per entry kind so that kind filtering queries only the relevant tables.
type result = {slug : string;kind : string;url : string;title : string;snippet : string;date : string;rank : float;parent_slugs : string list;}A search result with BM25 ranking and snippet. For links, parent_slugs lists the Bushel entry slugs that contain this link (e.g. notes or papers). Empty for non-link entries. tags lists the entry's tags (exact, from entry_tags table).
val create : sw:Eio.Switch.t -> _ Eio.Path.t -> tcreate ~sw path opens or creates the search database at path.
val create_memory : sw:Eio.Switch.t -> unit -> tcreate_memory ~sw () creates an in-memory search database. Ideal for the server where the index is rebuilt on startup.
val open_readonly : sw:Eio.Switch.t -> _ Eio.Path.t -> topen_readonly ~sw path opens the search database read-only for queries.
val rebuild : t -> Arod.Ctx.t -> unitrebuild t ctx drops and rebuilds all per-kind search tables from all entries and links in ctx.
search t ?limit input parses input using the search syntax and returns results from the relevant per-kind FTS5 tables. The syntax supports:
kind:paper (or kind:note, kind:project, kind:idea, kind:video, kind:link) — restrict to specific entry types"exact phrase" — match the exact phraseprefix* — prefix matching#tag — exact tag matching (uses entry_tags table, not FTS)Multiple kind filters are supported (queries their union). #tag tokens can be mixed with text: #ocaml memory finds entries tagged "ocaml" that also match FTS "memory". Returns empty if no text query or tags are provided.
search_tags t ?kinds ?limit tags returns entries matching ALL given tags exactly. Uses the entry_tags table for exact matching.
val all_tags : t -> (string * int) listall_tags t returns all unique tags with their counts, sorted by count descending.
val pp_result : Format.formatter -> result -> unitPretty-print a single search result.