# SearchHub A local search engine for your browser bookmarks. Import bookmarks from Firefox, Zen, Chrome, or Chromium, search them with full-text queries, and optionally forward searches to crates.io (via its public JSON API). Content is automatically tagged via local ONNX embeddings. ## Install **Prerequisites:** Rust (install via [rustup](https://rustup.rs/)). ```sh git clone https://github.com/your/repo.git cd search_hub cargo install --path . ``` This installs the `search_hub` binary to `~/.cargo/bin/search_hub`. To update later, pull the latest code and reinstall. ## First steps ```sh # Import bookmarks from Firefox (auto-discovers your profile) search_hub import firefox # Import from Chrome search_hub import chrome # Start the web UI search_hub serve ``` Open http://127.0.0.1:8080 in your browser. You can now search your bookmarks. Search queries are also forwarded to [crates.io](https://crates.io) via its public JSON API. Works as a custom search provider in Firefox/Zen via the OpenSearch protocol (your browser should auto-discover it at `/opensearch.xml`). ## CLI reference | Command | What it does | |---------|-------------| | `search_hub serve` | Start web UI on port 8080 | | `search_hub serve --port 3000` | Start on a custom port | | `search_hub import firefox` | Import bookmarks from Firefox | | `search_hub import chrome` | Import from Chrome/Chromium | | `search_hub import zen` | Import from Zen Browser | | `search_hub search "query"` | Search bookmarks from the terminal | | `search_hub list` | List all bookmarks | | `search_hub insert "Title" https://..."` | Add a bookmark (fetches content, auto-tags) | | `search_hub remove --id 1` | Delete a bookmark by ID | | `search_hub retag --all` | Re-run auto-tagging on all bookmarks | | `search_hub init-config` | Create a default config file at `~/.config/search_hub/config.toml` | All commands use `~/.local/share/search_hub/bookmarks.db` by default. Override with `--db-path` or set `db_path` in the config file. The first time you use a search or insert command, SearchHub downloads an ONNX embedding model to `.fastembed_cache/` in the project directory (about 30 MB). ## Configuration Run `search_hub init-config` to create `~/.config/search_hub/config.toml` with all available options commented out. Or create it manually: ```toml # Bookmark database path (default: platform data directory) # db_path = "/home/you/.local/share/search_hub/bookmarks.db" # Custom tags override the built-in defaults # [[tags]] # name = "my-custom-tag" # examples = ["example text one", "example text two"] # Which external search engines to use (default: ["crates.io"]) # enabled_engines = ["crates.io"] # Minimum confidence for auto-tagging (0.0 to 1.0, default: 0.6) # tagging_threshold = 0.6 # Hosts to skip when fetching content for bookmarking (default: local addresses) # exclude_urls = ["localhost", "127.0.0.1", "::1"] # Per-engine configuration (optional) # [engines.searxng] # instance = "https://search.kael.ink" # Best: use an existing public instance (see https://searx.space). # Also possible: run your own with Docker: # docker run -d --name searxng -p 8888:8080 searxng/searxng ``` ## Run the web server as a systemd user service Keeps the web UI running in the background, starts automatically on login. ```sh cp contrib/search-hub-web.service ~/.config/systemd/user/ systemctl --user daemon-reload systemctl --user enable --now search-hub-web.service ``` Check status with `systemctl --user status search-hub-web`. View logs with `journalctl --user -u search-hub-web -f`. ## Auto-import with systemd (Zen Browser) ```sh cp contrib/search-hub-import.service ~/.config/systemd/user/ cp contrib/search-hub-import.timer ~/.config/systemd/user/ systemctl --user daemon-reload systemctl --user enable --now search-hub-import.timer ``` This imports bookmarks from Zen Browser daily.