Expand description
Full-text search engine for Ox Content.
This crate provides a lightweight, high-performance full-text search engine for Markdown documents processed by Ox Content.
§Features
- TF-IDF based scoring for relevance ranking
- Multi-field search (title, body, headings, code)
- Prefix matching for autocomplete
- Serializable index for build-time generation
§Example
ⓘ
use ox_content_search::{SearchIndex, SearchIndexBuilder, SearchOptions};
// Build index at build time
let mut builder = SearchIndexBuilder::new();
builder.add_document("getting-started", "Getting Started", "Welcome to the docs...");
let index = builder.build();
// Serialize for client-side use
let json = index.to_json();
// Search at runtime
let results = index.search("getting started", &SearchOptions::default());Structs§
- Document
Indexer - Extracts searchable content from a Markdown AST using the Visitor pattern.
- Posting
- Posting list entry for inverted index.
- Scoped
Search Query - Parsed free-text query and requested search scopes.
- Search
Document - A searchable document in the index.
- Search
Index - The main search index structure.
- Search
Index Builder - Builder for constructing a search index.
- Search
Options - Search options.
- Search
Result - A search result with relevance score.
- Search
Runtime Options - Resolved options embedded in the client-side search runtime.
Enums§
- Field
- Document fields with different boost weights.
Functions§
- collect_
markdown_ files - Collects Markdown files under
src_dirfor search indexing. - generate_
search_ module - Generates the client-side search runtime module.
- generate_
search_ module_ with_ options - Generates the client-side search runtime module from typed options.
- get_
search_ document_ scopes - Derives hierarchical search scopes from a document id or URL.
- matches_
search_ scopes - Returns true when a search document belongs to at least one requested scope.
- parse_
scoped_ search_ query - Splits a raw query into free-text terms and
@scopeprefixes. - strip_
markdown_ extension - Removes the matching Markdown extension from a file path.
- write_
search_ index - Writes a serialized search index to
search-index.jsonunderout_dir.