Skip to main content

Crate ix

Crate ix 

Source
Expand description

ix — sub-millisecond code search via sparse trigram indexing.

ix pre-computes a byte-level trigram index to narrow search candidates to a fraction of the total file set, then verifies matches with a memory-constant streaming architecture. This eliminates the linear-scan bottleneck of traditional tools on large codebases.

§Installation

cargo install moeix

§Quick Start

ix --build /path/to/repo
ix "fn validate"
ix --regex "fn\\s+\\w+_handler" --context 3

§Library Usage

use ix::{Reader, Executor};

let reader = Reader::open(".ix/shard.ix")?;
let mut executor = Executor::new(&reader);
let matches = executor.execute(query);

§Module Build Order

formatvarinttrigrambloompostingstring_poolbuilderreaderplannerexecutorscanner

Cache layer: posting_cacheneg_cacheregex_poolcache_policy

§Feature Flags

  • notify (default) — File watcher + daemon (ixd) + Unix domain socket IPC
  • decompress — gz/zst/bz2/xz decompression
  • archive — zip/tar archive support
  • full — All optional features

Re-exports§

pub use crate::builder::Builder;
pub use crate::daemon_sock::ClientMessage;
pub use crate::daemon_sock::DaemonClient;
pub use crate::daemon_sock::DaemonServer;
pub use crate::daemon_sock::FileChange;
pub use crate::daemon_sock::FileOp;
pub use crate::daemon_sock::ServerMessage;
pub use crate::format::Beacon;
pub use crate::idle::IdleTracker;
pub use crate::watcher::Watcher;

Modules§

archive
Archive searching support (.zip, .tar.gz).
bloom
Per-file bloom filters.
builder
Index builder — the complete pipeline from files to .ix shard.
cache_policy
Adaptive cache policy driven by ResourceGuard memory pressure. Adaptive cache policy driven by llmosafe’s ResourceGuard pressure signal.
config
Configuration loading for ix.
daemon_sock
Unix domain socket interface for the ixd daemon.
decompress
Transparent decompression by file extension.
error
Error types for the ix crate.
executor
Query executor — search through the index and verify results.
format
Index file format constants and header parsing.
idle
Idle/dormancy detection for the daemon.
neg_cache
Negative result cache — skips re-verification of known non-matching files. Negative result cache.
planner
Query planner — transforms user input into an optimal index query plan.
posting
Posting list encode/decode (delta + varint + ZSTD compression).
posting_cache
LRU cache for decoded posting lists, keyed by trigram. LRU cache for decoded posting lists, keyed by trigram.
reader
Index reader — the mmap-based query-time interface.
regex_pool
Compiled regex pool — caches Regex objects to avoid recompilation. Compiled regex pool — caches Regex objects to avoid recompilation.
scanner
Fallback scanner (no index, competitive with ripgrep).
string_pool
Path string pool with prefix deduplication.
trigram
Trigram extraction — the core indexing primitive.
varint
Protobuf-style varint encoding/decoding.
watcher
File system watcher (notify crate) with debouncing.

Functions§

run_daemon
Run the daemon watching the given directory for changes and rebuilding the index.