tidaldb/tidal/docs/planning/milestone-5/phase-4/task-03-creator-search-executor.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

2.3 KiB

Task 03: Creator Search Executor

Goal

Extend SearchExecutor to route text index and ANN slot based on query.entity_kind. When entity_kind = Creator, use creator_text_index and the (EntityKind::Creator, "content") slot.

Files to Modify

  • tidal/src/query/search.rs — add creator_text_index field, routing in execute()
  • tidal/src/db/mod.rs — pass creator text index in search()
  • tidal/tests/m5p4_creator_search.rs — new integration tests

SearchExecutor Changes

Add creator_text_index: Option<&'a Arc<crate::text::TextIndex>> field.

In execute() Stage 1a:

let effective_text_index = match query.entity_kind {
    EntityKind::Creator => self.creator_text_index,
    _ => self.text_index,
};

In execute() Stage 1b ANN, use query.entity_kind instead of hardcoded EntityKind::Item:

match registry.get(query.entity_kind, "content") { ... }

Add builder method:

pub fn with_creator_text_index(mut self, idx: &'a Arc<crate::text::TextIndex>) -> Self {
    self.creator_text_index = Some(idx);
    self
}

TidalDb::search() Routing

if query.entity_kind == EntityKind::Creator {
    if let Some(idx) = self.creator_text_index.as_ref() {
        base_executor = base_executor.with_creator_text_index(idx);
    }
}

Note: for Creator search, pass None as text_index (item text index) to SearchExecutor::new() — or pass both and let the executor route. Simplest: always pass item text index to new(), add creator index via builder method, executor picks based on entity_kind.

Integration Tests

Create tidal/tests/m5p4_creator_search.rs:

  • step01_creator_text_search_returns_results() — write 200 creators, search "jazz", assert ≥ 1 result with bm25_score.is_some()
  • step02_creator_verified_filter() — search with filter(verified = "true"), assert all results have verified metadata
  • step03_creator_similar_to() — write embeddings, search with vector, assert results have semantic_score.is_some()
  • step04_creator_search_latency_under_20ms() — measure 10 iterations, assert p50 < 20ms

Acceptance Criteria

  • Creator search returns BM25-ranked results
  • Filter by verified = "true" works
  • Vector-only and hybrid search work for creators
  • All existing m5p3 item search tests still pass
  • Latency < 20ms at 200 creators