Installation
Add Exograph to your deps:
def deps do
[
{:exograph, "~> 0.7"}
]
endPostgres is required. ParadeDB's pg_search extension is optional — without
it, text search falls back to pg_trgm ILIKE, which is fast but not BM25-ranked.
Install pg_trgm if it is not already enabled:
CREATE EXTENSION IF NOT EXISTS pg_trgm;Index your project
Point Exograph at your source directories with --migrate to create the tables:
mix exograph.index --repo MyApp.Repo --migrate libTo also index tests and set a custom prefix:
mix exograph.index --repo MyApp.Repo --migrate --prefix exograph lib testFrom Elixir:
{:ok, index} =
Exograph.index("lib",
repo: MyApp.Repo,
prefix: "exograph",
migrate?: true
)migrate?: true runs Exograph's Ecto migrations under the configured prefix.
Re-running is safe; migrations are idempotent.
Search from CLI
Structural search — finds fragments matching an ExAST pattern:
mix exograph.search 'Repo.get!(_, _)' --repo MyApp.Repo --migrate libText search:
mix exograph.search 'TODO' --text --repo MyApp.Repo --migrate libRegex search:
mix exograph.search 'Repo\.get!\(' --regex --repo MyApp.Repo --migrate libStructural search with predicates:
mix exograph.search 'def _ do ... end' \
--repo MyApp.Repo --migrate lib \
--contains 'Repo.transaction(_)' \
--not-contains 'IO.inspect(_)'Start the web UI
mix exograph.web --prefix exograph --port 4200Open http://localhost:4200. The editor supports structural, text, and regex
modes. Pass --database-url or set EXOGRAPH_DATABASE_URL when not using an
application repo:
EXOGRAPH_DATABASE_URL=postgres://localhost/mydb \
mix exograph.web --prefix exograph --port 4200Index Hex.pm packages
Download and index packages straight from Hex.pm:
mix exograph.index.hex --mode top --limit 1000 --concurrency 8This streams: download tarball → extract to tmpdir → index → cleanup. Peak disk usage is proportional to concurrency, not total package count. Already-indexed packages are skipped automatically.
Watch progress live by adding --web:
mix exograph.index.hex --mode latest --concurrency 8 --web --port 4200The dashboard at http://localhost:4200/progress shows per-package status,
rate, and ETA.
Modes:
latest— most recent version of each package (default)top --limit N— top N most-downloaded packagesall— every published version
See Package Indexing for scale numbers and full options.
Next steps
- Querying — structural patterns, text/regex search, planning
- DSL — join code facts with structural predicates
- Mix Tasks — all CLI options
- Postgres and ParadeDB — performance tuning for large indexes