refactor(search): rename --after/--updated-after to --since/--updated-since

The --since naming is more intuitive (matches git log --since) and
consistent with the list commands which already use --since. Renames
the CLI flags, SearchCliFilters fields, SearchFilters fields,
autocorrect registry, and robot-docs manifest. No behavioral change.

Affected paths:
- cli/mod.rs: SearchArgs field + clap attribute rename
- cli/commands/search.rs: SearchCliFilters + run_search plumbing
- search/filters.rs: SearchFilters struct + apply_filters logic
- main.rs: handle_search + robot-docs JSON
- cli/autocorrect.rs: COMMAND_FLAGS entry for search

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-08 14:33:24 -05:00
parent 7dd86d5433
commit 940a96375a
5 changed files with 228 additions and 73 deletions

View File

@@ -53,8 +53,8 @@ pub struct SearchCliFilters {
pub project: Option<String>,
pub labels: Vec<String>,
pub path: Option<String>,
pub after: Option<String>,
pub updated_after: Option<String>,
pub since: Option<String>,
pub updated_since: Option<String>,
pub limit: usize,
}
@@ -63,22 +63,36 @@ pub fn run_search(
query: &str,
cli_filters: SearchCliFilters,
fts_mode: FtsQueryMode,
requested_mode: &str,
explain: bool,
) -> Result<SearchResponse> {
let db_path = get_db_path(config.storage.db_path.as_deref());
let conn = create_connection(&db_path)?;
let mut warnings: Vec<String> = Vec::new();
// Determine actual mode: vector search requires embeddings, which need async + Ollama.
// Until hybrid/semantic are wired up, we run lexical and warn if the user asked for more.
let actual_mode = "lexical";
if requested_mode != "lexical" {
warnings.push(format!(
"Requested mode '{}' is not yet available; falling back to lexical search.",
requested_mode
));
}
let doc_count: i64 = conn
.query_row("SELECT COUNT(*) FROM documents", [], |row| row.get(0))
.unwrap_or(0);
if doc_count == 0 {
warnings.push("No documents indexed. Run 'lore generate-docs' first.".to_string());
return Ok(SearchResponse {
query: query.to_string(),
mode: "lexical".to_string(),
mode: actual_mode.to_string(),
total_results: 0,
results: vec![],
warnings: vec!["No documents indexed. Run 'lore generate-docs' first.".to_string()],
warnings,
});
}
@@ -93,25 +107,25 @@ pub fn run_search(
.map(|p| resolve_project(&conn, p))
.transpose()?;
let after = cli_filters
.after
let since = cli_filters
.since
.as_deref()
.map(|s| {
parse_since(s).ok_or_else(|| {
LoreError::Other(format!(
"Invalid --after value '{}'. Use relative (7d, 2w, 1m) or absolute (YYYY-MM-DD) format.",
"Invalid --since value '{}'. Use relative (7d, 2w, 1m) or absolute (YYYY-MM-DD) format.",
s
))
})
})
.transpose()?;
let updated_after = cli_filters
.updated_after
let updated_since = cli_filters
.updated_since
.as_deref()
.map(|s| {
parse_since(s).ok_or_else(|| {
LoreError::Other(format!(
"Invalid --updated-after value '{}'. Use relative (7d, 2w, 1m) or absolute (YYYY-MM-DD) format.",
"Invalid --updated-since value '{}'. Use relative (7d, 2w, 1m) or absolute (YYYY-MM-DD) format.",
s
))
})
@@ -130,8 +144,8 @@ pub fn run_search(
source_type,
author: cli_filters.author,
project_id,
after,
updated_after,
since,
updated_since,
labels: cli_filters.labels,
path,
limit: cli_filters.limit,
@@ -163,10 +177,10 @@ pub fn run_search(
if filtered_ids.is_empty() {
return Ok(SearchResponse {
query: query.to_string(),
mode: "lexical".to_string(),
mode: actual_mode.to_string(),
total_results: 0,
results: vec![],
warnings: vec![],
warnings,
});
}
@@ -210,10 +224,10 @@ pub fn run_search(
Ok(SearchResponse {
query: query.to_string(),
mode: "lexical".to_string(),
mode: actual_mode.to_string(),
total_results: results.len(),
results,
warnings: vec![],
warnings,
})
}