The Rust Personal Knowledge Search Engine (PKSE) is a local, offline tool that allows you to search through your personal notes stored as .md or .txt files. It combines a CLI tool with an optional HTTP server to provide fast, searchable access to your documents.
PKSE is designed as a learning project for Rust, emphasizing ownership, borrowing, error handling, modular design, and idiomatic Rust practices.
- Folder Watching: Automatically watches the
./notesdirectory and updates the index when files change. - Document Loader: Reads and processes
.mdand.txtfiles into structuredDocumentobjects. - Tokenizer: Normalizes and tokenizes text into words for indexing.
- Inverted Index: Maps words to the documents they appear in, enabling fast search.
- CLI Search Tool: Allows you to search your notes directly from the terminal.
- Optional HTTP Server: Provides a
/searchendpoint via Axum for programmatic access. - Rust Engineering Practices: Modular design, proper error handling, tests, and documentation.
This project is not just about building a search engine, it’s about learning Rust deeply through practical implementation:
- Understanding ownership, borrowing, and lifetimes
- File I/O and error handling (
Result,Option) - Working with
HashMapand other collections - Modular project structure and separation of concerns
- Async programming and event-driven design
- Writing tests and documentation
pkse/
├── src/
│ ├── main.rs # Entry point
│ ├── index.rs # Inverted index logic
│ ├── watcher.rs # Folder watcher logic
│ └── search.rs # CLI and HTTP search functions
│ └── ingestion.rs # Everything related to loading files
└── Cargo.toml # Cargo configuration
└── README.md # Repo readme/info file
cargo run -- search "your query"- Run the server
cargo run -- server- Access search endpoint
GET http://localhost:3000/search?q=your+query
- Clone the repository
- Create a
notes/folder and add.mdor.txtfiles - Build and run with
cargo run - Start searching with the CLI or optional HTTP server
This project is meant for learning Rust hands-on. You are encouraged to:
- Read Rust documentation and examples
- Experiment with the code
- Only ask AI for guidance, not full solutions
- Add tests and improve modularity
This project is open for personal learning purposes.