redis-search
Scaffold RediSearch full-text, vector, or search-cache adapters in an ArchiPy app. Use for "add search", "full-text/semantic/vector search", "embeddings index", or "cache search results".
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- redis-search
- description
- Scaffold RediSearch full-text, vector, or search-cache adapters in an ArchiPy app. Use for "add search", "full-text/semantic/vector search", "embeddings index", or "cache search results".
02 资源文件 3
- 脚本reference/fulltext_adapter.py2.7 KB
- 脚本reference/search_cache_adapter.py1.6 KB
- 脚本reference/vector_adapter.py2.5 KB
03 SKILL.md 正文
Redis Search Skills
Overview
Redis search via ArchiPy (archipy[redis]):
- RediSearch: full-text via
RedisAdapter.search_index(name)→RedisSearchHandle - Vector search: KNN / range via
SearchQueryDTO.from_knn/from_range - Search caching: cache-aside around expensive search results
Canonical layout and ArchiPy constraints: ../archipy-docs/reference/adapters.md (Adapters + Redis Search), resolved relative
to this SKILL.md's directory in the plugin installation — not the app workspace. Templates:
reference/fulltext_adapter.py, reference/vector_adapter.py, reference/search_cache_adapter.py.
Resolve files under reference/ relative to this SKILL.md in the plugin installation
($PLUGIN_ROOT/skills/redis-search/, $CURSOR_PLUGIN_ROOT/skills/redis-search/, or ${CLAUDE_SKILL_DIR}/). These are plugin templates,
not app-relative paths. Copy and adapt them into the app; never edit the plugin copies.
Read first
Read these plugin rules in full before generating files (paths relative to this skill directory; Claude Code: ${CLAUDE_SKILL_DIR}/../../rules/):
../../rules/using-archipy-adapters.mdc
Before writing files
- Inspect the domain, Redis config/adapters, DTOs, index naming, key prefixes, DI wiring, and tests.
- Infer data structure, sync/async style, and existing search conventions.
- Ask only for unresolved choices: search type, domain, query behavior, and vector dimension/metric when applicable.
- Preserve existing indexes and adapters. Treat schema or prefix changes as migrations; do not silently replace them.
Prefer ArchiPy
uv add "archipy[redis]"
Thin domain wrapper around RedisAdapter.search_index() — not raw client.ft().
Key library symbols:
RedisAdapter.search_index(name)/list_search_indexes()- DTOs:
IndexSchemaDTO,TextFieldConfig,TagFieldConfig,NumericFieldConfig,VectorFieldConfig - Queries:
SearchQueryDTO,SearchQueryDTO.from_knn(...),SearchQueryDTO.from_range(...) - Documents:
HashDocumentUpsertDTO,JsonDocumentUpsertDTO - Types:
RedisIndexType,VectorAlgorithm,VectorDistanceMetric, … - Helpers:
pack_vector/unpack_vectorfromarchipy.adapters.redis.search
Requires Redis 8+ (query engine). Cluster needs hash-tagged prefixes (e.g. {products}:).
Generate
repositories/<domain>/
├── adapters/
│ └── <domain>_search_adapter.py # or _vector_ / _search_cache_
└── <domain>_repository.py
- Copy the matching template from
reference/, rename class/index/prefix to the domain. - Define a domain error (e.g.
ProductSearchError) undermodels/errors/— templates import it. - Wire via DI in
configs/containers.py. - Map Redis/RediSearch failures with
raise DomainError(...) from e.
Full-text
Use reference/fulltext_adapter.py: ensure_index via info() → create_index(IndexSchemaDTO, …) only when missing;
search via handle.search(SearchQueryDTO(...)).
Vector
Use reference/vector_adapter.py: VectorFieldConfig + SearchQueryDTO.from_knn. Adjust DIM / algorithm.
Search caching
Use reference/search_cache_adapter.py: cache-aside with Redis get/setex. Repository orchestrates search + cache;
logics own invalidation rules.
Do not
- Sync and async must be separate classes.
- No business logic in adapters — map data and talk to infrastructure only.
- Do not create a top-level
adapters/<name>/package — domain adapters live under repositories. - Prefer ArchiPy search handle API; only drop to raw Redis for operations the handle does not cover.
- Use specific exceptions; always
raise ... from e. - Prefer the ArchiPy search-handle API — never raw
client.ft()for operations the handle covers.
Verify
- Run formatter/linter, then Behave scenarios (
@needs-redis,/scaffold-bdd) that hit the search endpoint for matches, empty results, and mapped failures. - For vector search, verify encoded vector dimension and distance metric match the schema.
- If Docker is unavailable, say so; do not replace the Redis container with a mock.
- Run the
archipy-reviewersubagent on the changes and fix every Must fix finding it reports. - Report files, schema assumptions, dependency changes, and commands run.
Docs
- https://syntaxarc.github.io/ArchiPy/tutorials/adapters/ (Redis Search section)
- https://syntaxarc.github.io/ArchiPy/api_reference/adapters/
- Bundled:
../archipy-docs/reference.md
04 同仓库更多 Skills
scaffold-utils
Add or wire pure helpers/utils, preferring ArchiPy utils (datetime, JWT, password, file, string). Use for "add a helper/util function", "format dates", "hash passwords", or "generate tokens".
scaffold-service
Scaffold a thin FastAPI router or gRPC servicer under services/{domain}/v{n}/ with AppUtils bootstrap. Use for "add an endpoint/route/API", "expose via REST/gRPC", or "new API version".
scaffold-observability
Configure ArchiPy 5.x OpenTelemetry traces, metrics, logs, and instrumentation. Use for "add tracing/metrics/OTel", "Prometheus/Pushgateway", or migrating off Sentry, Elastic APM, or old Prometheus.
scaffold-models
Scaffold ArchiPy models under models/: domain/repository DTOs, errors, optional entities and types. Use for "add DTO/schema/request/response model", "new error type", or "SQLAlchemy entity".
scaffold-logic
Scaffold an ArchiPy logic (use case) under logics/{domain}/ with a unit-of-work decorator and DTO I/O. Use for "add business logic", "new use case", "transactional operation", or "service layer method".
scaffold-interceptor
Add or wire cross-cutting FastAPI/gRPC interceptors or middleware, preferring ArchiPy's. Use for "add middleware", "request ID/logging/auth interceptor", or "gRPC interceptor".