create_index_settings

command
v0.34.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 6 Imported by: 0

README

Index Creation and Settings Example

This example shows how to create an index and configure its settings for better search.

What it does

  1. Create an "articles" index with "id" as primary key
  2. 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
  3. 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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL