You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tamo 74d1a67a99
Use the workspace inheritance feature of rust 1.64
1 month ago
fuzz Update filter-parser/fuzz/.gitignore 8 months ago
src update the syntax of the geoboundingbox filter to uses brackets instead of parens around lat and lng 2 months ago
Cargo.toml Use the workspace inheritance feature of rust 1.64 1 month ago Replace MeiliSearch by Meilisearch 1 year ago

Filter parser

This workspace is dedicated to the parsing of the Meilisearch filters.

Most of the code and explanation are in the 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.


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 "


The workspace have been fuzzed with cargo-fuzz.


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

cargo install cargo-fuzz


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 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.