tidaldb/tidal/ai-lookup/features/query-language.md
jx12n 3bcfb3c576 feat: Bazel build, crate docs/ai-lookup, docker images, and engine hardening
- Add BUILD.bazel across tidal, tidal-net, tidal-server, tidalctl for bzlmod build
- Add tidal/ crate docs (README, CHANGELOG, CONTRIBUTING, AGENTS, CLAUDE, API, ARCHITECTURE) and ai-lookup reference
- Add docker standalone/cluster/deploy images, compose, and prometheus config
- Harden WAL (batch format, writer, dedup, diagnostics), text syncer/collectors, and vector registry
- Expand tidalctl CLI and tests; restructure WAL/visibility integration test suites
- Refine tidal-net transport/client/server and tidal-server cluster/scatter-gather
2026-06-07 18:29:38 -06:00

66 lines
1.4 KiB
Markdown

# Query Language
**Last Updated:** 2026-02-19
**Confidence:** High
## Summary
The query interface is a single operation that encapsulates candidate retrieval, filtering, ranking, and diversity enforcement. Three primary operations: RETRIEVE (feed/browse), SEARCH (text+semantic), and SIGNAL (engagement write-back).
**Key Facts:**
- One query replaces what currently requires 6 systems
- RETRIEVE: feed generation, browse, related content
- SEARCH: keyword + semantic + hybrid retrieval
- SIGNAL: engagement event write-back (closes the feedback loop in the same transaction)
- All queries accept: FOR USER, USING PROFILE, FILTER, DIVERSITY, LIMIT
- Filters are composable — any combination is valid
**File Pointer:** `VISION.md:47-57`
## Query Shapes
**Feed retrieval:**
```
RETRIEVE items
FOR USER @user_id
CONTEXT feed
USING PROFILE for_you
FILTER unseen, unblocked, format:video
DIVERSITY max_per_creator:2, format_mix:true
LIMIT 50
```
**Search:**
```
SEARCH items
QUERY "rust tutorial beginner"
VECTOR query_vector
FOR USER @user_id
USING PROFILE search
DIVERSITY max_per_creator:2
LIMIT 20
```
**Signal write:**
```
SIGNAL like
item: @item_id
user: @user_id
timestamp: now()
```
**Related content:**
```
RETRIEVE items
SIMILAR TO @item_id
FOR USER @user_id
USING PROFILE related
FILTER unseen
LIMIT 10
```
## Related Topics
- [Ranking Profiles](../services/ranking-profiles.md)
- [Filters](./filters.md)
- [Sort Modes](./sort-modes.md)