Files

21 lines
845 B
Bash
Executable File

#!/usr/bin/env bash
# Example queries showing off Meilisearch behaviour through the demo API.
# Requires the API to be running (task run) and the index seeded (task seed).
set -euo pipefail
API="${API:-http://localhost:8080}"
show() {
echo
echo "=== $1"
shift
curl -fsS "$@" | (command -v jq >/dev/null && jq . || cat)
}
show "typo tolerance: 'matrx' still finds The Matrix" "$API/search?q=matrx&limit=3"
show "prefix search while typing: 'spid'" "$API/search?q=spid&limit=3"
show "full-text over the overview field: 'dream'" "$API/search?q=dream&limit=3"
show "facet + filter: sci-fi after 2000, rating >= 8" "$API/search?q=&genre=Sci-Fi&min_year=2000&min_rating=8"
show "empty query: facets + ranking rule rating:desc" "$API/search?q=&limit=5"
show "single document by id" "$API/movies/1"