Documentation

Finch

Typo-tolerant full-text search in a single binary.

Finch builds an inverted index over your documents and answers ranked, typo-tolerant queries over a small HTTP API. There's no cluster to manage — one process holds the index and serves searches.

Documents are grouped into indexes. Each index has its own schema of searchable and filterable fields, so a books index and a users index can live side by side.

#Installation

Finch ships as one static binary. Place it on your host and start it:

# download and start
$ curl -sSL get.asdzxc2.didns.ru/install | sh
$ finch serve --data /var/lib/finch
→ listening on :7280 · api ready
By default Finch binds to 127.0.0.1:7280. Put it behind your own reverse proxy to expose it over TLS.

#Quickstart

# add a document
$ curl -X POST :7280/v1/books/docs \
    -d '{"title":"Dune"}'
→ indexed · id 1

# run a search
$ curl ':7280/v1/books/search?q=doon'
{"hits":[{"id":1,"title":"Dune"}]}

#Configuration

Configure with flags, environment variables, or a small YAML file. Flags take precedence.

# finch.yaml
data:    /var/lib/finch
listen:  127.0.0.1:7280
log:     info
search:
  typo_tolerance: true

#API reference

Every route lives under /v1/<index>. Requests without a valid token return 401.

Method & pathDescription
POST /v1/{index}/docsAdd or update a document.
GET /v1/{index}/searchRun a search query.
DELETE /v1/{index}/docs/{id}Remove a document.
GET /v1/{index}/settingsRead the index schema.
GET /healthLiveness probe. Returns 200 when search is ready.

#CLI

The finch binary is both the server and the client.

CommandDescription
finch serveStart the search server.
finch index <name>Create an index.
finch reindex <name>Rebuild an index.
finch statusShow index sizes and query stats.