# README
Index Creation and Settings Example
This example shows how to create an index and configure its settings for better search.
What it does
- Create an "articles" index with "id" as primary key
- Configure comprehensive settings:
- Searchable attributes (title, content, author, tags)
- Displayed attributes (what fields to return)
- Filterable attributes (what can be used in filters)
- Sortable attributes (what can be sorted)
- Ranking rules (how to order results)
- Stop words (common words to ignore)
- Synonyms (alternative words)
- Typo tolerance (allow spelling mistakes)
- Pagination limits
- Verify the settings were applied
Settings configured
- Searchable: title, content, author, tags
- Filterable: category, author, publish_date, status, featured
- Sortable: publish_date, title, author
- Ranking rules: words, typo, proximity, attribute, sort, exactness
- Stop words: the, a, an, and, or, but, in, on, at, to, for, of, with, by
- Synonyms: programming = coding/development, javascript = js/ecmascript, golang = go
- Typo tolerance: 1 typo for 5+ letter words, 2 typos for 9+ letter words
- Max results: 1000 per search
Configuration
export MEILI_HOST="http://localhost:7700"
export MEILI_API_KEY="your-api-key"
Run it
go run ./examples/create_index_settings
The example will create an "articles" index, configure comprehensive settings, add sample articles, and demonstrate how the settings improve search results.