Skip to main content

Crate ox_content_search

Crate ox_content_search 

Source
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§

DocumentIndexer
Extracts searchable content from a Markdown AST using the Visitor pattern.
Posting
Posting list entry for inverted index.
ScopedSearchQuery
Parsed free-text query and requested search scopes.
SearchDocument
A searchable document in the index.
SearchIndex
The main search index structure.
SearchIndexBuilder
Builder for constructing a search index.
SearchOptions
Search options.
SearchResult
A search result with relevance score.
SearchRuntimeOptions
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_dir for 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 @scope prefixes.
strip_markdown_extension
Removes the matching Markdown extension from a file path.
write_search_index
Writes a serialized search index to search-index.json under out_dir.