Files
zeekayandHanzo Dev 0e3fa5b9fc brand: rename every internal too — our users read the source
Devs are the users here, so an internal name is a user-visible name. This
finishes what the previous commit started on the serving surface:

  MEILISEARCH_* / meilisearch_*  ->  INDEX_* / index_*   (statics, metrics)
  MEILI_*                        ->  INDEX_*             (env vars)
  Meili-Include-Metadata         ->  Index-Include-Metadata (HTTP header)
  MeiliParams, meili_client, setup_meilisearch, and every remaining prose
  mention -> the index equivalents

519 files, 1621 insertions and 1621 deletions — a 1:1 substitution, no
structural change.

**This changes the deployment contract**: the binary now reads INDEX_MASTER_KEY,
INDEX_ENV and INDEX_DB_PATH. The App CR in hanzoai/universe must move to those
names IN THE SAME ROLLOUT as the new image — the running 1.37.0 still reads
MEILI_*, so flipping the CR early would start it with no master key.

CI now publishes ghcr.io/hanzoai/index, matching the repo.

There is no Rust toolchain on the box this was authored on, and building images
locally is against policy anyway, so CI is the compiler: a red build here costs
nothing because production is pinned to 1.37.0 and is not touched by it.

NOT renamed: the crate/directory names (milli, search, search-types...). Those
move Cargo.toml paths and workspace members together and deserve their own
verified pass, not a blind one.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 13:38:50 -07:00

1.5 KiB

Filter parser

This workspace is dedicated to the parsing of the Hanzo Index filters.

Most of the code and explanation are in the lib.rs. Especially, the BNF of the filters at the top of this file.

The parser use nom to do most of its work and nom-locate to keep track of what we were doing when we encountered an error.

Cli

A simple main is provided to quick-test if a filter can be parsed or not without bringing milli. It takes one argument and try to parse it.

cargo run -- 'field = value' # success
cargo run -- 'field = "doggo' # error => missing closing delimiter "

Fuzz

The workspace have been fuzzed with cargo-fuzz.

Setup

You'll need rust-nightly to execute the fuzzer.

cargo install cargo-fuzz

Run

When the filter parser is executed by the fuzzer it's triggering a stackoverflow really fast. We can avoid this problem by limiting the max_len of libfuzzer at 500 characters.

cargo fuzz run parse -- -max_len=500

What to do if you find a bug in the parser

  • Write a test at the end of the lib.rs to ensure it never happens again.
  • Add a file in the corpus directory with your filter to help the fuzzer find new bugs. Since this directory is going to be heavily polluted by the execution of the fuzzer it's in the gitignore and you'll need to force push your new test.