tidaldb/ai-lookup/features/query-language.md
jordan 413b712c0a chore: initialize tidalDB repository with schema foundation and standards
- Schema phase 1 (tasks 01-02): EntityId, EntityKind, Timestamp, Score, SignalTypeDef, DecayModel, Window, WindowSet — all with property tests and benchmarks scaffolding
- Stub modules for storage, signals, query, ranking
- Full documentation suite: VISION, USE_CASES, SEQUENCE, API, CODING_GUIDELINES, ai-lookup, research docs, specs, roadmap, planning docs
- Marketing site (Next.js) with blog infrastructure
- .claude/ agents and skills for the tidalDB development workflow
- Foundation standards enforced: thiserror + tracing declared as dependencies, clippy::unwrap_used = deny added to lint config
- .gitignore hardened: .next/, node_modules/, .env, secrets, logs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 12:52:20 -07: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)