Skip to main content

Crate qmd

Crate qmd 

Source
Expand description

QMD - Query Markdown Documents

A high-performance local search engine for markdown files with full-text search, vector semantic search, and LLM-powered features.

§Features

  • Full-text search with BM25 ranking via SQLite FTS5
  • Vector semantic search with local embeddings (GGUF models)
  • Hybrid search with query expansion and RRF fusion
  • Reranking with cross-encoder models
  • Collection management for organizing document sets
  • Automatic model download from HuggingFace

§Quick Start

use qmd::{Store, EmbeddingEngine};
use anyhow::Result;

fn main() -> Result<()> {
    // Open the document store
    let store = Store::new()?;

    // Full-text search (BM25)
    let results = store.search_fts("rust programming", 10, None)?;

    // Vector search (requires embedding model)
    let mut engine = EmbeddingEngine::load_default()?;
    let query_emb = engine.embed_query("how to use rust")?;
    let vec_results = store.search_vec(&query_emb.embedding, 10, None)?;

    Ok(())
}

Re-exports§

pub use error::QmdError;
pub use error::Result;
pub use store::CollectionInfo;
pub use store::DocumentResult;
pub use store::IndexStatus;
pub use store::SearchResult;
pub use store::SearchSource;
pub use store::Store;
pub use store::convert_git_bash_path;
pub use store::find_similar_files;
pub use store::is_absolute_path;
pub use store::is_docid;
pub use store::is_virtual_path;
pub use store::match_files_by_glob;
pub use store::normalize_filesystem_path;
pub use store::normalize_path_separators;
pub use store::parse_virtual_path;
pub use store::should_exclude;
pub use llm::BatchRerankResult;
pub use llm::CHUNK_OVERLAP_TOKENS;
pub use llm::CHUNK_SIZE_TOKENS;
pub use llm::Chunk;
pub use llm::Cursor;
pub use llm::EmbeddingEngine;
pub use llm::EmbeddingResult;
pub use llm::GenerationEngine;
pub use llm::GenerationResult;
pub use llm::IndexHealth;
pub use llm::Progress;
pub use llm::PullResult;
pub use llm::QueryType;
pub use llm::Queryable;
pub use llm::RerankDocument;
pub use llm::RerankEngine;
pub use llm::RerankResult;
pub use llm::RrfResult;
pub use llm::SnippetResult;
pub use llm::TokenChunk;
pub use llm::chunk_document;
pub use llm::chunk_document_by_tokens;
pub use llm::cosine_similarity;
pub use llm::expand_query_simple;
pub use llm::extract_snippet;
pub use llm::format_doc_for_embedding;
pub use llm::format_eta;
pub use llm::format_query_for_embedding;
pub use llm::hybrid_search_rrf;
pub use llm::pull_model;
pub use llm::pull_models;
pub use llm::reciprocal_rank_fusion;
pub use llm::render_progress_bar;
pub use llm::resolve_model;
pub use collections::add_collection;
pub use collections::add_context;
pub use collections::get_collection;
pub use collections::list_all_contexts;
pub use collections::list_collections;
pub use collections::remove_collection;
pub use collections::remove_context;
pub use collections::rename_collection;
pub use collections::set_global_context;
pub use formatter::OutputFormat;
pub use formatter::add_line_numbers;
pub use formatter::format_bytes;
pub use formatter::format_documents;
pub use formatter::format_ls_time;
pub use formatter::format_search_results;
pub use formatter::format_time_ago;

Modules§

collections
Collections configuration management.
config
Configuration constants and utilities.
error
Error types for the qmd application.
formatter
Output formatting utilities.
llm
LLM module for QMD - embedding and vector search support.
store
Database store for document indexing and retrieval.