A fast, single-binary CLI that indexes a text file and lets you search it with ranked results. Designed for quick grepping with smarter scoring.
- Indexes a plain text file into an in-memory inverted index
- Case-insensitive by default, optional case-sensitive matching
- AND/OR query modes
- Ranked results with frequency and proximity scoring
- Top-N limiting
- Interactive REPL mode
- Compact output suitable for scripting
Requirements: Rust 1.70+.
cargo build --releaseThe binary will be at target/release/search-engine-lite.
On Windows PowerShell, you can run the binary directly:
./target/release/search-engine-lite --file .\README.md --search rustsearch-engine-lite --file ./notes.txt --search "rust indexing"
search-engine-lite --file ./notes.txt --search "pipeline" --mode or --limit 20
search-engine-lite --file ./notes.txt --interactive
search-engine-lite --file ./notes.txt --stats--file <PATH>: Input text file to index (required)--search <QUERY>: One-off query string--mode <and|or>: Matching mode (default:and)--limit <N>: Max results to print (default: 10)--case-sensitive: Enable case-sensitive tokenization--interactive: Start an interactive prompt--stats: Print index stats and top frequent terms
Each result prints: line_number score line_text
Example:
42 3.125 Building a compact inverted index in Rust
- Quick lookup:
search-engine-lite --file ./README.md --search "inverted index"- Browse interactively:
search-engine-lite --file ./README.md --interactive --limit 5- Streaming read with a compact in-memory map
- Simple tokenizer tuned for ASCII and common punctuation
- Proximity scoring favors lines where query terms appear closer together
cargo run -- --file ./README.md --search rust
cargo testMIT