A fast, local search engine built in Rust with vector embeddings and SQLite storage.
- 🔍 Full-Text + Semantic Search using embeddings generated and stored locally
- 📁 Local file indexing and search
- 🗄️ SQLite-based storage
- 📚 Both library and CLI interfaces
curl -sSL https://raw.githubusercontent.com/nnanto/localsearch/main/scripts/install.sh | bashirm https://raw.githubusercontent.com/nnanto/localsearch/main/scripts/install.ps1 | iexDownload the appropriate binary for your platform from the latest release:
curl -L https://github.com/nnanto/localsearch/releases/latest/download/localsearch-linux-x86_64.tar.gz | tar xz
sudo mv localsearch /usr/local/bin/curl -L https://github.com/nnanto/localsearch/releases/latest/download/localsearch-macos-x86_64.tar.gz | tar xz
sudo mv localsearch /usr/local/bin/curl -L https://github.com/nnanto/localsearch/releases/latest/download/localsearch-macos-aarch64.tar.gz | tar xz
sudo mv localsearch /usr/local/bin/- Download localsearch-windows-x86_64.zip
- Extract the ZIP file
- Add the extracted directory to your PATH environment variable
If you have Rust installed, you can build from source:
cargo install --git https://github.com/nnanto/localsearch --features cliOr clone and build:
git clone https://github.com/nnanto/localsearch.git
cd localsearch
cargo build --release --features cli
sudo cp target/release/localsearch /usr/local/bin/After installation, verify that the tool is working:
localsearch --helpYou should see the help output for the localsearch CLI tool.
To update to the latest version, simply re-run the installation command. The installer will replace the existing binary with the latest version.
sudo rm /usr/local/bin/localsearchRemove the installation directory and update your PATH environment variable to remove the localsearch directory.
If you get permission errors on Linux/macOS, make sure you're running the installation with appropriate permissions (using sudo when needed).
If the localsearch command is not found after installation, make sure the installation directory is in your PATH:
- Linux/macOS:
/usr/local/binshould be in your PATH - Windows: The installation directory should be added to your PATH environment variable
Some antivirus software may flag the binary as suspicious. This is a common issue with Rust binaries. You may need to add an exception for the localsearch binary.
# Index documents (uses system default directories)
localsearch index /path/to/documents
# Search for content
localsearch search "your query here"By default, localsearch uses system-appropriate directories:
- Cache: Model files are stored in the system cache directory (e.g.,
~/.cacheon Linux,~/Library/Cacheson macOS) - Database: SQLite database is stored in the application data directory (e.g.,
~/.local/shareon Linux,~/Library/Application Supporton macOS)
You can override these defaults:
# Use custom database location
localsearch index /path/to/documents --db /custom/path/to/database.db
# Use custom cache directory for embeddings
localsearch index /path/to/documents --cache-dir /custom/cache/path
# Use both custom paths
localsearch index /path/to/documents --db /custom/db.db --cache-dir /custom/cache
# Search with custom paths
localsearch search "query" --db /custom/db.db --cache-dir /custom/cache# Index JSON files (default)
localsearch index data.json --file-type json
# Index text files
localsearch index /path/to/text/files --file-type text# Different search types
localsearch search "query" --search-type semantic
localsearch search "query" --search-type fulltext
localsearch search "query" --search-type hybrid # default
# Limit results
localsearch search "query" --limit 5
# Pretty output
localsearch search "query" --prettyuse localsearch::{SqliteLocalSearchEngine, LocalEmbedder, DocumentIndexer, LocalSearch, SearchType, DocumentRequest, LocalSearchDirs};
fn main() -> anyhow::Result<()> {
// Option 1: Use default system directories
let dirs = LocalSearchDirs::new();
let db_path = dirs.default_db_path();
let embedder = LocalEmbedder::new_with_default_model()?;
// Option 2: Use custom cache directory
// let custom_cache = std::path::PathBuf::from("/custom/cache");
// let embedder = LocalEmbedder::new_with_cache_dir(custom_cache)?;
let mut engine = SqliteLocalSearchEngine::new(&db_path.to_string_lossy(), Some(embedder))?;
// Index a document
engine.insert_document(DocumentRequest {
path: "some/unique/path".to_string(),
content: "This is example content".to_string(),
metadata: None,
})?;
// Search
let results = engine.search("example", SearchType::Hybrid, Some(10))?;
Ok(())
}# Clone the repository
git clone https://github.com/nnanto/localsearch.git
cd localsearch
# Run tests
cargo test
# Run CLI with features
cargo run --features cli -- search "query"MIT License - see LICENSE file for details.