feat(timeline): add entity-direct seeding and round-robin evidence selection
Enhance the timeline command with two major improvements: 1. Entity-direct seeding syntax (bypass search): lore timeline issue:42 # Timeline for specific issue lore timeline i:42 # Short form lore timeline mr:99 # Timeline for specific MR lore timeline m:99 # Short form This directly resolves the entity and gathers ALL its discussions without requiring search/embedding. Useful when you know exactly which entity you want. 2. Round-robin evidence note selection: Previously, evidence notes were taken in FTS rank order, which could result in all notes coming from a single high-traffic discussion. Now we: - Fetch 5x the requested limit (or minimum 50) - Group notes by discussion_id - Select round-robin across discussions - This ensures diverse evidence from multiple conversations API changes: - Renamed total_events_before_limit -> total_filtered_events (clearer semantics) - Added resolve_entity_by_iid() in timeline.rs for IID-based entity resolution - Added seed_timeline_direct() in timeline_seed.rs for search-free seeding - Added round_robin_select_by_discussion() helper function The entity-direct mode uses search_mode: "direct" to distinguish from "hybrid" or "lexical" search modes in the response metadata. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -175,7 +175,7 @@ pub async fn run_timeline(config: &Config, params: &TimelineParams) -> Result<Ti
|
||||
query: params.query.clone(),
|
||||
search_mode: seed_result.search_mode,
|
||||
events,
|
||||
total_events_before_limit: total_before_limit,
|
||||
total_filtered_events: total_before_limit,
|
||||
seed_entities: seed_result.seed_entities,
|
||||
expanded_entities: expand_result.expanded_entities,
|
||||
unresolved_references: expand_result.unresolved_references,
|
||||
@@ -342,7 +342,7 @@ fn format_entity_ref(entity_type: &str, iid: i64) -> String {
|
||||
/// Render timeline as robot-mode JSON in {ok, data, meta} envelope.
|
||||
pub fn print_timeline_json_with_meta(
|
||||
result: &TimelineResult,
|
||||
total_events_before_limit: usize,
|
||||
total_filtered_events: usize,
|
||||
depth: u32,
|
||||
include_mentions: bool,
|
||||
fields: Option<&[String]>,
|
||||
@@ -355,7 +355,7 @@ pub fn print_timeline_json_with_meta(
|
||||
expansion_depth: depth,
|
||||
include_mentions,
|
||||
total_entities: result.seed_entities.len() + result.expanded_entities.len(),
|
||||
total_events: total_events_before_limit,
|
||||
total_events: total_filtered_events,
|
||||
evidence_notes_included: count_evidence_notes(&result.events),
|
||||
discussion_threads_included: count_discussion_threads(&result.events),
|
||||
unresolved_references: result.unresolved_references.len(),
|
||||
|
||||
Reference in New Issue
Block a user