Skip to main content

Crate syntext

Crate syntext 

Source
Expand description

Hybrid code search index for agent workflows.

syntext indexes repository files using sparse n-grams with a pre-trained frequency weight table, then narrows queries to a small candidate set before verification. Three index components:

  • Content index: sparse n-gram posting lists (delta-varint or Roaring bitmap)
  • Path index: Roaring bitmap component sets for path/type scoping
  • Symbol index (optional, --features symbols): Tree-sitter + SQLite

§Usage

use syntext::{Config, SearchOptions};
use syntext::index::Index;

let config = Config::new(".syntext".into(), ".".into());

// Build or open the index.
let index = Index::build(config).unwrap();

// Search with default options.
let results = index.search("parse_query", &SearchOptions::default()).unwrap();
for m in &results {
    println!("{}:{}: {}", m.path.display(), m.line_number,
        String::from_utf8_lossy(&m.line_content));
}

Re-exports§

pub use error::IndexError;

Modules§

cli
Command-line interface (used by the st binary). CLI entry point: st <pattern>, st index, st status, st update.
error
Error types for index operations. Error types for syntext index operations.
hook
Git hook integrations (used by the st binary). Agent hook integration support.
index
Core index management, writing, and snapshot components. Index builder (Index::build) and reader (Index::open).

Structs§

Config
Configuration for index building and searching.
FileMatches
All matches within a single file, plus the exact bytes the verifier matched against.
IndexStats
Counters and metadata reported by Index::stats().
SearchMatch
A single line-level match returned by a search query.
SearchOptions
Search options.