feat(grpc): handle IndexSymbols from client, index to OpenSearch

When client sends IndexSymbols after session start, Sol indexes
the symbols to the sol_code OpenSearch index. Each symbol becomes
a SymbolDocument with file_path, name, kind, signature, docstring,
branch, and source="local".
This commit is contained in:
2026-03-24 00:41:30 +00:00
parent c213d74620
commit c6d11259a9

View File

@@ -159,6 +159,36 @@ async fn run_session(
}
}
}
Some(client_message::Payload::IndexSymbols(idx)) => {
// Index client symbols to OpenSearch code index
if let Some(ref os) = state.opensearch {
let index_name = state.code_index_name();
let mut indexer = crate::code_index::indexer::CodeIndexer::new(
os.clone(), index_name, String::new(), 100,
);
let now = chrono::Utc::now().timestamp_millis();
for sym in &idx.symbols {
indexer.add(crate::code_index::schema::SymbolDocument {
file_path: sym.file_path.clone(),
repo_owner: None,
repo_name: idx.project_name.clone(),
language: sym.language.clone(),
symbol_name: sym.name.clone(),
symbol_kind: sym.kind.clone(),
signature: sym.signature.clone(),
docstring: sym.docstring.clone(),
start_line: sym.start_line as u32,
end_line: sym.end_line as u32,
content: sym.content.clone(),
branch: idx.branch.clone(),
source: "local".into(),
indexed_at: now,
}).await;
}
indexer.flush().await;
info!(count = idx.symbols.len(), project = idx.project_name.as_str(), "Indexed client symbols");
}
}
Some(client_message::Payload::End(_)) => {
session.end();
tx.send(Ok(ServerMessage {