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 {
    index_dir: ".syntext".into(),
    repo_root: ".".into(),
    ..Config::default()
};

// 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));
}

Modules§

base64
cli
CLI entry point: st <pattern>, st index, st status, st update.
hook
Agent hook integration support.
index
Index builder (Index::build) and reader (Index::open).
path
Path index: component-based Roaring bitmap sets for fast path/type filtering.
posting
Posting list encoding, decoding, intersection, and union.
query
Query planning: GramQuery tree, query router, and cardinality-based ordering.
search
Search executor: routes queries to the gram index or full scan, then verifies candidates against actual file content.
tokenizer
Sparse n-gram tokenizer.

Structs§

Config
Configuration for index building and searching.
IndexStats
Counters and metadata reported by Index::stats().
SearchMatch
A single line-level match returned by a search query.
SearchOptions
Search options.

Enums§

IndexError
Errors returned by index operations.