Skip to content
index and full text search local files
Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src ignore logging setup errors Aug 19, 2019
.gitignore
Cargo.lock
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md
example_config.toml

README.md

Searchr

A simple command line full text search engine for your local plain text files.

Installation

Standard rust project. Git clone and cargo build should work fine.

If you run Archlinux, you can install from the aur: searchr-git.

Usage

  1. Create a config file to configure what files you want indexed and where to store the indexes. (see configuration section below)
  2. Create the index: mkdir <my index location> && searchr index
  3. Search: searchr search "foo bar"

See tantivy docs for the supported query syntax.

Configuration

See example_config.toml for an example. The software searches for the configuration file in the following locations in order, and uses the first match:

  1. path passed to -c on the command line
  2. $XDG_CONFIG_HOME/searchr/config.toml
  3. $HOME/.config/searchr/config.toml

If none are found, the software exits with an error.

Notes

  • builds indexes and searches with tantivy. This also means that other tantivy-based tools can be used on the indexes, like tantivy-cli.

Why?

My note taking workflow involves a large number of plain text files loosely inspired by Zettelkasten and vimwiki. Since I generally avoid categories and hierarchies, various types of searches is the main method I use for finding a note. Currently there are two methods I use for finding a note:

  1. fuzzy text search on the note filenames (fzf or this script)
  2. grep through the files

The first method is perfect if I roughly know what what I'm looking for and know there's a note with that in the title. The second is great if I'm looking for a specific pattern or word. What's missing though is a general full text content search. Grepping doesn't work so well when you're looking for a set of keywords. So that's where this tool comes in! Now I have a third method for searching my notes that sits between a fuzzy title search and specific regex searches.

There are other full text search engines around, but so far I haven't found something that is small and simple. I wanted something that I could configure and set up by nothing more than editing a short config file and running a single command.

License

Copyright © 2019 Samuel Walladge

Dual licensed under either of

at your option.

You can’t perform that action at this time.