docs/generated/contracts.mdgenerated from code

Reference · 1 min read

api-search

Contracts: api-search.

Source: crates/lvcs-api/src/search.rs.

ruston main
1/// `search` (discussion:owner/303): the lines of main's text files that hold2/// `query`, ignoring case, in path order, at most `limit` (and at most3/// `SEARCH_RESULTS_MAX`), optionally only under the path prefix `under`.4/// It reads the main tree's files, which are the documents' text.5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]6pub struct SearchParams {7    pub query: String,8    #[serde(default, skip_serializing_if = "Option::is_none")]9    pub under: Option<String>,10    #[serde(default, skip_serializing_if = "Option::is_none")]11    pub limit: Option<u32>,12}1314/// `search` result. `truncated` when more lines matched than it lists.15#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]16pub struct SearchResult {17    #[serde(default)]18    pub matches: Vec<SearchMatch>,19    #[serde(default)]20    pub truncated: bool,21}2223/// One matching line.24#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]25pub struct SearchMatch {26    pub address: String,27    /// Its line, 1-based.28    pub line: usize,29    /// The line, cut to `RANGE_CONTEXT_MAX_CHARS` code points around the30    /// first match.31    pub text: String,32}