1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Hanzo Cloud API
*
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Span {
/// EndLine is the last line of the span, inclusive. It equals Line for a one-line span rather than being zero or absent.
#[serde(rename = "endLine", skip_serializing_if = "Option::is_none")]
pub end_line: Option<i32>,
/// File is the path inside the repo, relative to its root and never absolute.
#[serde(rename = "file", skip_serializing_if = "Option::is_none")]
pub file: Option<String>,
/// Kind is what the indexer decided this chunk IS — \"func\", \"method\", \"type\", \"struct\", \"interface\", \"var\", \"const\", or \"block\" for a run of code that declares nothing. Absent when the chunker could not classify it.
#[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
/// Line is where the span starts, 1-based, as an editor counts.
#[serde(rename = "line", skip_serializing_if = "Option::is_none")]
pub line: Option<i32>,
/// Repo is the indexed repository the span was found in, as it was indexed (\"owner/name\"). A search may be scoped to one repo or run across all of them, so this is how a caller tells the results apart.
#[serde(rename = "repo", skip_serializing_if = "Option::is_none")]
pub repo: Option<String>,
/// context: match | definition | caller
#[serde(rename = "role", skip_serializing_if = "Option::is_none")]
pub role: Option<String>,
/// Score ranks this span against the OTHERS IN THE SAME RESPONSE and means nothing across responses or between tiers: the hybrid tier's number is a reciprocal-rank fusion sum (Σ 1/(60+rank), so tenths at best), the symbol tier's is a descending position count, and the text and semantic tiers pass through bm25 and cosine. Compare within a list; never threshold on it.
#[serde(rename = "score", skip_serializing_if = "Option::is_none")]
pub score: Option<f64>,
/// Snippet is the code itself: a bounded excerpt on /search, the whole chunk on /context — which is why the same type serves both and why a /context span is the one an agent pastes into its window.
#[serde(rename = "snippet", skip_serializing_if = "Option::is_none")]
pub snippet: Option<String>,
/// Symbol is the declared name, when the span declares one. Absent on a block.
#[serde(rename = "symbol", skip_serializing_if = "Option::is_none")]
pub symbol: Option<String>,
/// Tier is which retrieval produced the span: \"hybrid\" (the default — all three fused), \"text\" (trigram/FTS), \"regex\", \"semantic\" (vector), or \"symbol\". It is what explains a Score, so the two travel together.
#[serde(rename = "tier", skip_serializing_if = "Option::is_none")]
pub tier: Option<String>,
}
impl Span {
pub fn new() -> Span {
Span {
end_line: None,
file: None,
kind: None,
line: None,
repo: None,
role: None,
score: None,
snippet: None,
symbol: None,
tier: None,
}
}
}