tidaldb/tidal/docs/planning/milestone-5/phase-4/task-01-creator-text-indexing.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

1.9 KiB

Task 01: Creator Text Indexing

Goal

Add a separate Tantivy text index for creator entities, parallel to the existing item text index. Creator text fields are declared in the schema via creator_text_field(). The background syncer enqueues writes from write_creator().

Files to Modify

  • tidal/src/schema/validation.rs — add creator_text_fields vec to Schema and SchemaBuilder
  • tidal/src/schema/mod.rs — re-export nothing new (types already exported)
  • tidal/src/db/mod.rs — add creator text index fields, spawn creator syncer, extend write_creator(), add reload_creator_text_index()

Schema Changes

Add creator_text_fields: Vec<TextFieldDef> to both Schema and SchemaBuilder.

impl SchemaBuilder {
    pub fn creator_text_field(&mut self, key: &str, field_type: TextFieldType) -> &mut Self {
        self.creator_text_fields.push(TextFieldDef { key: key.to_owned(), field_type });
        self
    }
}

impl Schema {
    pub fn creator_text_fields(&self) -> &[TextFieldDef] {
        &self.creator_text_fields
    }
}

TidalDb Changes

Add three new fields parallel to text_index, text_tx, text_syncer_thread:

creator_text_index: Option<Arc<crate::text::TextIndex>>,
creator_text_tx: std::sync::Mutex<Option<crossbeam::channel::Sender<crate::text::PendingWrite>>>,
creator_text_syncer_thread: std::sync::Mutex<Option<std::thread::JoinHandle<crate::Result<()>>>>,

Spawn in from_parts() using the same pattern as the item syncer. In write_creator(), enqueue to creator_text_tx when present.

Add reload_creator_text_index() helper for tests.

Acceptance Criteria

  • SchemaBuilder::creator_text_field() compiles
  • Writing a creator with matching metadata enqueues to the creator text index
  • reload_creator_text_index() reloads the reader for test synchronization
  • Existing item text index is unaffected