Search (oridecon-search)
Full-text search and indexing for Oridecon Framework — Elasticsearch, Meilisearch, Typesense, and OpenSearch
Overview
Section titled “Overview”oridecon-search provides a unified SearchEngineProtocol interface over Meilisearch, Elasticsearch, OpenSearch, Typesense, PostgreSQL full-text, MySQL, MongoDB, and SQLite. It supports typo-tolerant search, faceting, fuzzy matching, result caching, and analytics. All services are wired via SearchProvider, which registers the search engine protocol with the DI container.
Full documentation: docs.oridecon.dev
Install
Section titled “Install”uv add oridecon-search# Optional extrasuv add "oridecon-search[meilisearch]" # Meilisearchuv add "oridecon-search[elasticsearch]" # Elasticsearch 8.xuv add "oridecon-search[typesense]" # Typesenseuv add "oridecon-search[postgres,mysql,sqlite,mongodb]" # Database backendsQuick Start
Section titled “Quick Start”from oridecon import Applicationfrom oridecon.di.module import Module, module
# Import the module from the packagefrom oridecon.search import SearchModule
@module(imports=[SearchModule.configure(...)])class AppModule(Module): pass
async with Application.boot(modules=[AppModule]) as app: # use app.container to resolve services ...Configuration
Section titled “Configuration”Default config: Pass
SearchConfig()explicitly to use all defaults (in-memory backend).SearchModule.configure()with no arguments raisesValueError— a config or engine must be specified. The in-memoryNullBackendis fine for development and tests.
Option 1 — YAML file
Section titled “Option 1 — YAML file”search: backend_type: meilisearch meilisearch: url: http://localhost:7700 api_key: "${MEILI_API_KEY}" query: strategy: fuzzy default_limit: 10Option 2 — Profiles + Environment Variables (recommended)
Section titled “Option 2 — Profiles + Environment Variables (recommended)”export ORI_SEARCH__ENABLED=true# Environment variables for each fieldOption 3 — Python
Section titled “Option 3 — Python”from oridecon.search.config import SearchConfig, BackendTypefrom oridecon.search import SearchModule
config = SearchConfig(backend_type=BackendType.MEILISEARCH, ...)SearchModule.configure(config)Config reference
Section titled “Config reference”| Field | Default | Env var | Description |
|-------|---------|---------|-------------|
| backend_type | memory | ORI_SEARCH__BACKEND_TYPE | Active backend (meilisearch, elasticsearch, opensearch, typesense, postgres, mysql, sqlite, mongodb, memory) |
| timeout | 30.0 | ORI_SEARCH__TIMEOUT | Default request timeout in seconds |
| query.strategy | fuzzy | ORI_SEARCH__QUERY__STRATEGY | Query strategy (fuzzy, exact, semantic, hybrid) |
| query.default_limit | 20 | ORI_SEARCH__QUERY__DEFAULT_LIMIT | Default number of results returned |
| query.max_limit | 100 | ORI_SEARCH__QUERY__MAX_LIMIT | Maximum allowed result limit |
| query.fuzzy_threshold | 0.8 | ORI_SEARCH__QUERY__FUZZY_THRESHOLD | Fuzzy match threshold (0–1; 1 = exact) |
| meilisearch.url | http://localhost:7700 | ORI_SEARCH__MEILISEARCH__URL | MeiliSearch server URL |
| meilisearch.api_key | null | ORI_SEARCH__MEILISEARCH__API_KEY | MeiliSearch authentication key |
| elasticsearch.hosts | [http://localhost:9200] | ORI_SEARCH__ELASTICSEARCH__HOSTS | Elasticsearch cluster hosts |
| operations.bulk_chunk_size | 500 | ORI_SEARCH__OPERATIONS__BULK_CHUNK_SIZE | Documents per bulk index request |
Module Factory Methods
Section titled “Module Factory Methods”| Method | Description |
|--------|-------------|
| SearchModule.configure(config, enable_facets) | Configure with explicit SearchConfig |
| SearchModule.stub() | Minimal config for testing |
Key Features
Section titled “Key Features”- Protocol abstraction — Swap backends without changing application code
- Meilisearch — Typo-tolerant, instant search with faceting
- Elasticsearch — Full Lucene query DSL; aggregations; multi-index
- Typesense — Fast, schema-enforced search with scoped API keys
- PostgreSQL FTS —
tsvector/tsqueryviaoridecon-sql; no extra infra - MySQL FTS —
FULLTEXTindex support for MySQL / MariaDB - MongoDB Text — Native
$textoperator with language stemming - SQLite FTS5 — Local development with zero dependencies
- Cached search — Transparent result caching via
CacheBackend - Analytics — Query recording and hit-rate analytics for ranking improvement
Testing
Section titled “Testing”async with Application.boot(modules=[SearchModule.stub()]) as app: # your test code ...Key Source Files
Section titled “Key Source Files”| File | What it contains |
|------|----------------|
| src/oridecon/search/module.py | SearchModule class with factory methods |
| src/oridecon/search/di/provider.py | SearchProvider — wires search protocols into DI container |
| src/oridecon/search/config.py | SearchConfig and sub-config classes |
| src/oridecon/search/engine/ | Search engine abstraction and federation |
| src/oridecon/search/backends/ | Search engine implementations for each backend |
| src/oridecon/search/indexing/ | Index management and document indexing |