//! `search_records` — the whole file, on the same engine as the app's Find//! screen.//!//! The RANKING half is//! [`cotton_core::rules::search_everything::search_everything_file`] — the//! same function the phone calls — so the assistant and the owner rank one//! file one way. What lives HERE is everything the engine deliberately does//! not know, because it is MCP vocabulary rather than search://!//! THE NOTE/JOURNAL SPLIT. The engine folds a journal page into the note//! lane under a flag; both MCP kinds ride that one lane and the flag splits//! them again on the way out.//!//! THE WORDS FOR NAMELESS KINDS. `namelessTitle` is the server's analogue of//! the app's `hitTitle`, in the assistant's register.//!//! THE MEMORY `[slug]` LINE. An assistant cites entries by slug, so a memory//! row that reached one without its handle would be unusable as a reference.//!//! THE MEANING LANE'S ABSENCE. Four shapes, and every one of them is an//! ANSWER rather than a thrown error (spec D19/D20): a tool failure makes an//! assistant retry, and three of the four are settled states. The text lane's//! hits are never withheld because the second lane went dark.use std::collections::HashMap;use cotton_core::rules::search_everything::{ search_everything_file, EverythingHit, EverythingKind, EverythingLanes,EverythingSearchOptions, SearchDriver, SearchError, SearchRow, SemanticQuery, SqlParam,SqlValueasEngineValue,};use cotton_store::driver::Driver;use cotton_store::protocol::js;use rusqlite::types::ValueasSqlValue;use serde_json::{Map, Value};usecrate::mcp::dispatch::{Ctx, ToolResult};usecrate::mcp::handlers::common::{bounded_limit, fail, projects, require_string, Valid};usecrate::mcp::protocol::ToolFailure;// ── the vocabulary ──────────────────────────────────────────────────────────/// `SEARCH_KINDS` — the kinds `search_records` can FIND.////// Wider than the `get_record` vocabulary on purpose: a search hit's follow-up/// is not always `get_record` (a message opens with `read_message_thread`, a/// session with `list_sessions`, a goal with `list_goals`, a reader page has no/// expander yet). Held as a slice in the TypeScript's declared order, because/// the refusal sentence prints it and an assistant reads that list to correct/// itself. User-defined table ids use the same shared-format id grammar;/// the catalogue permits that grammar rather than a closed built-in enum.pubconst SEARCH_KINDS: &[&str] = &["todo","event","note","journal","person","document","memory","message","thread","email","email_thread","session","transaction","session_message","photo","video","call",// A secret (v6 of the Rust ladder). The lane indexes the PLAIN columns —// name, site, username, service — and never the sealed payload, so a// person typing "gmail" finds their login and nobody finds a password."secret",// Code hosting (v19). A pull request and an issue answer through their own// FTS index over title and body; a repository and a release through an// indexed LIKE scan over the key/tag and the name. `repo_comment` is// absent and stays absent: a comment is read in the timeline of the thing// it is on, and a workspace-wide index over review chatter would answer// every search with "looks good to me"."repository","pull","issue","release",// A connection by its name, the number or address it reaches, or its// kind — a LIKE scan that reads neither its vault secret nor its config.// Not a record kind: `get_record_by_table` with table `connection` opens it."connection",// gen-kind: search-kinds];/// The two lanes and the pair.pubconst SEARCH_MODES: &[&str] = &["text", "meaning", "both"];// ── the arguments ───────────────────────────────────────────────────────────#[derive(Debug, Clone)]pubstructSearchArgs {pub query: String,pub kinds: Vec<String>,pub limit: i64,/// Which lanes answer. ALWAYS set — absence defaults to `text`, and that/// is the whole compatibility story: a caller written before the meaning/// lane existed gets what it always got.pub mode: String,}/// `validateSearch`.pubfn validate_search(args: &Map<String, Value>) -> Valid<SearchArgs> {letSome(query) = require_string(args, "query") else {return fail("query is required"); };letmut kinds: Vec<String> = SEARCH_KINDS .iter() .map(|kind| (*kind).to_string()) .collect();ifletSome(raw) = args.get("kinds") {letSome(items) = raw.as_array() else {return fail("kinds must be an array"); };ifletSome(bad) = items.iter().find(|item| { !item .as_str() .is_some_and(cotton_core::definitions::is_valid_id) }) {return fail(format!("invalid kind {}. Use a table id or one of: {}", js::json_stringify(bad), SEARCH_KINDS.join(", ") )); }// An explicit empty array means "search nothing", which is a mistake// the caller cannot have meant — read it as "search everything".if !items.is_empty() { kinds = items .iter() .filter_map(|item| item.as_str().map(str::to_string)) .collect(); } }letmut mode = "text".to_string();ifletSome(raw) = args.get("mode") {if !raw .as_str() .is_some_and(|value| SEARCH_MODES.contains(&value)) {return fail(format!("unknown mode {}. Allowed: {}", js::json_stringify(raw), SEARCH_MODES.join(", ") )); } mode = raw.as_str().unwrap_or("text").to_string(); }Ok(SearchArgs { query, kinds, limit: bounded_limit(args, 20, 50), mode, })}// ── the file, as the engine asks for it ─────────────────────────────────────/// The engine's [`SearchDriver`] over the store's own handle.////// The bridge the ledger's "the search API" note asks the server to write: no/// `rusqlite` type appears in any engine signature, so the translation lives on/// this side of the seam and nowhere else.////// **`pub` because the phone's `/find` read needs the same bridge** and a second/// copy of it in `cotton-ffi` would be a second answer to "how does a store row/// become an engine row" — forty lines of pure type translation, wrong the day/// the store grows a column type. The phone links this crate, so it takes the/// one that exists. `read.find` calls the ENGINE rather than the `search`/// handler because the tool is the assistant's register — it flattens to one/// array, splits journal out of the note lane and appends the memory slug line/// — while the app wants hits grouped per section with totals.pubstructFileSearchDriver<'a>(pub &'a Driver);/// The index this file's mail is searched through: the wide `fts_mail` once/// it is whole, `fts_emails` while it still fills in the background (v122,/// `cotton_store::fts_fill`). Both the phone's Find and `search_records` ask/// it, so the swap happens for both at the same moment.pubfn mail_index_of(db: &Driver) -> cotton_core::rules::search_everything::MailIndex {let filling = cotton_store::fts_fill::filling(db, "fts_mail").map_or(true, |fill| fill.is_some()); cotton_core::rules::search_everything::mail_index(filling)}fn to_engine_value(value: &SqlValue) -> EngineValue {match value {SqlValue::Null => EngineValue::Null,SqlValue::Integer(number) => EngineValue::Integer(*number),SqlValue::Real(number) => EngineValue::Real(*number),SqlValue::Text(text) => EngineValue::Text(text.clone()),SqlValue::Blob(bytes) => EngineValue::Blob(bytes.clone()), }}fn to_sql_value(value: &SqlParam) -> SqlValue {match value {EngineValue::Null => SqlValue::Null,EngineValue::Integer(number) => SqlValue::Integer(*number),EngineValue::Real(number) => SqlValue::Real(*number),EngineValue::Text(text) => SqlValue::Text(text.clone()),EngineValue::Blob(bytes) => SqlValue::Blob(bytes.clone()), }}fn to_engine_row(row: &cotton_store::driver::Row) -> SearchRow {SearchRow::new( row.columns() .iter() .map(|(name, value)| (name.clone(), to_engine_value(value))), )}implSearchDriverforFileSearchDriver<'_> {fn all(&self, sql: &str, params: &[SqlParam]) -> Result<Vec<SearchRow>, SearchError> {let bound: Vec<SqlValue> = params.iter().map(to_sql_value).collect();self.0 .all(sql, &bound) .map(|rows| rows.iter().map(to_engine_row).collect()) .map_err(|error| SearchError::Driver(error.to_string())) }/// The binding's own single-row call, rather than materialising a result/// set to take its head — the reason the trait keeps `get` at all.fn get(&self, sql: &str, params: &[SqlParam]) -> Result<Option<SearchRow>, SearchError> {let bound: Vec<SqlValue> = params.iter().map(to_sql_value).collect();self.0 .get(sql, &bound) .map(|row| row.as_ref().map(to_engine_row)) .map_err(|error| SearchError::Driver(error.to_string())) }}// ── the meaning lane ────────────────────────────────────────────────────────// THE MEANING LANE'S THREE SETTLED ANSWERS are read straight out of the file by// `crate::embed::query::resolve_meaning_lane_offline` — the switch, the two// server-local tables and the generation stamp, asked in the order the spec// gives them (D13, D14). They were a `mod embed_shim` here while `src/embed/`// did not exist; the module landed with the indexer and the shim MOVED into it// rather than being copied, because two copies of "is the switch on" is exactly// how the indexer and this lane would eventually stop agreeing about what a// person consented to./// Why the meaning lane has nothing to say — `MeaningLaneAbsence`.#[derive(Debug, Clone, PartialEq, Eq)]enumLaneAbsence {/// The owner has not turned semantic search on. The default, and it stays/// the default.Off,/// On, but no vector has been written yet.Empty,/// The provider or the AI gate said no.Unreachable,}implLaneAbsence {fn as_str(&self) -> &'static str {matchself {LaneAbsence::Off => "off",LaneAbsence::Empty => "empty",LaneAbsence::Unreachable => "unreachable", } }}/// What the lane answered.#[derive(Debug, Clone)]enumMeaningLane {/// The embedded query, and the generation it must be scored against.////// OWNED, where the engine's own `SemanticQuery` borrows: the engine's/// options are built from these two fields at the point of use.Ready { vector: Vec<u8>, model: String },Absent { reason: LaneAbsence,/// One sentence, for a person or an assistant to read. note: String, },}/// Is this file ready to answer by meaning, and what does it compare against?////// Reads the switch first and creates nothing: a workspace that never turned/// this on has no `_embeddings` table, and being SEARCHED must not be what/// brings one into being — only the indexer creates.////// The generation compared against is `_embed_state.active_model`, never the/// model this server would index with today: during a model change the table/// holds two generations at once, and a query embedded at the new model scored/// against the old model's rows is comparing vectors from two different/// geometries — numbers come out, and every one of them is meaningless.////// FOUR ways it has nothing to say and every one of them is an ANSWER, never a/// thrown error (D20). Three are settled states, decided with no network call/// at all by `embed::query::resolve_meaning_lane_offline` — the same three/// reads `GET /v1/search/status` makes, in one place so the two surfaces cannot/// disagree. The fourth is a fault: the provider refused, or this server has no/// embedder. It is reported as an absence with its reason attached rather than/// as a silently shorter result list, which is the one thing a degraded search/// must never look like (D19).////// ON THIS BUILD `off` is the only reachable answer for a real file:/// `cotton_ai_access.semantic_search` is build-order step 6 of the spec and is/// not a column of the schema this build reads, so the switch is structurally/// off for every workspace. The rest of this function is exercised against a/// file that HAS the column, which is what the migration will produce.fn resolve_meaning_lane(ctx: &Ctx<'_>, query: &str) -> MeaningLane {let model = matchcrate::embed::query::resolve_meaning_lane_offline( ctx.db(), ctx.workspace_id, query, ) {Ok(model) => model,Err(absent) => return from_offline(absent), };// The rail a dispatcher hands this call ANSWERS a vector it embedded// before it took the file (`meaning_query`); it never dials from here.letSome(rail) = ctx.services.embed_query.clone() else {returnMeaningLane::Absent { reason: LaneAbsence::Unreachable, note: "Search by meaning could not run: this server has no embedding key.".to_string(), }; };match rail(query.trim()) {Ok(vector) => MeaningLane::Ready { vector, model },// The typed reason, not a swallowed one: a ceiling and a dead network// are different problems and the reader has to be able to tell.Err(reason) => MeaningLane::Absent { reason: LaneAbsence::Unreachable, note: format!("Search by meaning could not run: {reason}"), }, }}/// The question a `search_records` call will ask by meaning, as the handler/// reads it — `None` for a text search, or a call the handler would refuse.////// Embedding it is a round trip to a third party, and the handler runs inside/// the person's file. So a dispatcher asks this BEFORE it takes the file,/// settles the lane's offline half (`embed::query::resolve_meaning_lane_offline`)/// and embeds `query.trim()` with nothing held, then hands the call a rail/// that answers that vector (`crate::mcp::dispatch::before_the_file`).pubfn meaning_query(args: &Map<String, Value>) -> Option<String> { validate_search(args) .ok() .filter(|args| args.mode != "text") .map(|args| args.query)}/// The three settled answers, in this module's own vocabulary.////// Two enums rather than one shared across the crate: `embed::query`'s is the/// LANE's, and this one is what `search_records` puts on the wire. They agree/// by this function, which is the one place a new absence has to be spelled/// twice — and Rust's exhaustiveness makes forgetting it a build failure.fn from_offline(absent: crate::embed::query::MeaningLane) -> MeaningLane {match absent {crate::embed::query::MeaningLane::Absent { reason, note } => MeaningLane::Absent { reason: match reason {crate::embed::query::MeaningLaneAbsence::Off => LaneAbsence::Off,crate::embed::query::MeaningLaneAbsence::Empty => LaneAbsence::Empty,crate::embed::query::MeaningLaneAbsence::Unreachable => LaneAbsence::Unreachable, }, note, },// `resolve_meaning_lane_offline` answers `Ok(model)` when the file is// ready; it never hands back a `Ready` for this arm to unwrap.crate::embed::query::MeaningLane::Ready { .. } => MeaningLane::Absent { reason: LaneAbsence::Empty, note: "Search by meaning is on, but nothing has been indexed yet.".to_string(), }, }}// ── the tool ────────────────────────────────────────────────────────────────pubfn search_records(ctx: &mutCtx<'_>, args: &Map<String, Value>) -> ToolResult {let all_tables = args .get("kinds") .and_then(Value::as_array) .is_none_or(Vec::is_empty);let args = validate_search(args)?;// The parser accepts the table-id grammar; the file supplies the dynamic// vocabulary. Keep unknown-id refusals while accepting real synced tables,// including a newer definition this build will skip with a logged reason.if args.kinds.iter().any(|kind| !SEARCH_KINDS.contains(&kind.as_str())) {let defined = crate::definitions::definition_rows(ctx, None)?;ifletSome(kind) = args.kinds.iter().find(|kind| { !SEARCH_KINDS.contains(&kind.as_str()) && !defined.iter().any(|row| row.id == **kind) }) {return fail(format!("unknown kind {}. Allowed: {}; or a synced table id", js::json_stringify(&Value::from(kind.as_str())), SEARCH_KINDS.join(", ") )); } }// The engine folds journal into the note lane under a flag; both MCP kinds// ride that one lane and the flag splits them again below.letmut engine_kinds: Vec<EverythingKind> = Vec::new();for kind in &args.kinds {let name = if kind == "journal" { "note" } else { kind };ifletSome(parsed) = EverythingKind::parse(name) {if !engine_kinds.contains(&parsed) { engine_kinds.push(parsed); } } }// The meaning lane, when it was asked for. A lane that cannot run is an// absence with a reason attached — the text hits below are not withheld// because the second lane went dark.let meaning = (args.mode != "text").then(|| resolve_meaning_lane(ctx, &args.query));let lanes = match args.mode.as_str() {"meaning" => EverythingLanes::Meaning,"both" => EverythingLanes::Both, _ => EverythingLanes::Text, };let options = EverythingSearchOptions { mail_index: Some(mail_index_of(ctx.db())), per_kind: Some(args.limit), kinds: Some(&engine_kinds), lanes: Some(lanes),// With `lanes` naming the meaning half and this absent, the engine's// meaning half is simply empty — the honest shape when the switch is// off, nothing is indexed, or the provider could not be reached. The// CALLER says why, and the envelope below does. meaning: match &meaning {Some(MeaningLane::Ready { vector, model }) => Some(SemanticQuery { vector, model, min_score: None, }), _ => None, }, offset: 0, as_sections: false, };let read = search_everything_file(&FileSearchDriver(ctx.db()), &args.query, &options) .map_err(|error| ToolFailure::new(error.to_string()))?;let memory_meta = memory_meta_for(ctx, &read.hits)?;// A hit is answered only while a tool here draws its table — the rows of// a table no tool draws are read by no path (credentials included).let drawn: std::collections::BTreeSet<String> =crate::definitions::definition_rows(ctx, None)? .into_iter() .filter(|row| {let built = cotton_core::definitions::builtin_table_definitions().iter().find(|table| table.id == row.id); !crate::definitions::retired_builtin(row, built) }) .map(|row| row.id) .collect();letmut records: Vec<Value> = Vec::new();for hit in &read.hits {// The engine's note lane answers for two MCP kinds; keep only the// one(s) the caller asked for.let kind = if hit.kind == EverythingKind::Note && hit.journal {"journal" } else { hit.kind.as_str() };if !drawn.contains(super::record::kind_table(kind)) { continue; }ifcrate::home_arrangement::require_table(ctx.read.driver(), ctx.workspace_id, kind).is_err() { continue; }if !args.kinds.iter().any(|wanted| wanted == kind) {continue; }letmut row = Map::new(); row.insert("kind".to_string(), Value::from(kind)); row.insert("table".to_string(), Value::from(kind)); row.insert("snippet".to_string(),Value::from(hit.snippet.clone().unwrap_or_default()), ); row.insert("id".to_string(), Value::from(hit.id.clone())); row.insert("title".to_string(),Value::from(hit.title.clone().unwrap_or_else(|| nameless_title(hit))), );// **A PULL, AN ISSUE AND A RELEASE ARE ADDRESSED BY THEIR REPOSITORY// PLUS THEIR OWN NUMBER OR TAG**, never by the uuid this row's `id`// carries — `get_pull` and `get_issue` take `(repositoryId, number)`// and refuse a uuid by name. So a hit that answered `id` alone was a// hit an assistant could not open: it had to `list_repositories`, then// `list_pulls` on each, and match on the title it had just been given.// The phone's Find carries the same three fields for the same reason.if matches!( hit.kind,EverythingKind::Pull | EverythingKind::Issue | EverythingKind::Release ) {ifletSome(repo_id) = &hit.repo_id { row.insert("repositoryId".to_string(), Value::from(repo_id.clone())); }ifletSome(number) = hit.number { row.insert("number".to_string(), Value::from(number)); }ifletSome(tag) = &hit.tag { row.insert("tag".to_string(), Value::from(tag.clone())); } }if hit.kind == EverythingKind::Memory {ifletSome(detail) = memory_meta.get(&hit.id) { row.insert("detail".to_string(), Value::from(detail.clone())); } } elseifletSome(snippet) = &hit.snippet { row.insert("detail".to_string(), Value::from(snippet.clone())); }ifletSome(when) = &hit.when { row.insert("when".to_string(), Value::from(when.clone())); }if hit.struck { row.insert("struck".to_string(), Value::Bool(true)); }ifletSome(thread_id) = &hit.thread_id { row.insert("threadId".to_string(), Value::from(thread_id.clone())); }ifletSome(sent_at) = &hit.sent_at { row.insert("sentAt".to_string(), Value::from(sent_at.clone())); }ifletSome(page) = hit.page { row.insert("page".to_string(), Value::from(page)); }if hit.matched_by.is_some() { row.insert("matchedBy".to_string(), Value::from("meaning")); }if hit.archived { row.insert("archived".to_string(), Value::Bool(true)); } records.push(Value::Object(row)); }letmut totals = Map::new();for (section, total) in read.totals.iter() {if !drawn.contains(super::record::kind_table(section.as_str())) { continue; }ifcrate::home_arrangement::require_table(ctx.read.driver(), ctx.workspace_id, section.as_str()).is_ok() { totals.insert(section.as_str().to_string(), Value::from(total)); } }let engine_count = records.len();letmut skipped = Vec::new();super::search_tables::append(ctx, &args, all_tables, &mut records, &mut totals, &mut skipped)?;let generic_tables: Vec<String> = records[engine_count..] .iter() .filter_map(|row| row["table"].as_str().map(str::to_string)) .collect();// Keep the existing table grouping and each engine's relevance order for// ties. A generic title hit ranks with engine title hits, before a match// only in text; meaning hits remain after the text lane.letmut groups: Vec<(String, Vec<Value>)> = Vec::new();for row in records {let table = row["table"].as_str().unwrap_or_default().to_string();ifletSome((_, hits)) = groups.iter_mut().find(|(id, _)| *id == table) { hits.push(row); } else { groups.push((table, vec![row])); } }let query = args.query.to_lowercase();letmut records = Vec::new();for (table, mut hits) in groups {if generic_tables.contains(&table) {// Live before archived, then by how well the title matched. hits.sort_by_cached_key(|hit| {let title = hit["title"].as_str().unwrap_or_default().to_lowercase();let archived = hit["archived"] == true; (archived, std::cmp::Reverse(if hit["matchedBy"] == "meaning" {0 } elseif title == query {3 } elseif title.contains(&query) {2 } else {1 })) });// Preserve the engine's separate Related lane after the text cap.let related: Vec<Value> = hits .iter() .filter(|r| r["matchedBy"] == "meaning") .cloned() .collect(); hits.retain(|r| r["matchedBy"] != "meaning"); hits.truncate(args.limit as usize); hits.extend(related); } records.extend(hits); }letmut out = Map::new(); out.insert("records".to_string(), Value::Array(records)); out.insert("totals".to_string(), Value::Object(totals));if !skipped.is_empty() {// The tables not searched, each with why: the rest still answered. out.insert("skipped".to_string(), Value::Array(skipped)); }ifletSome(MeaningLane::Absent { reason, note }) = meaning {letmut envelope = Map::new(); envelope.insert("available".to_string(), Value::Bool(false)); envelope.insert("reason".to_string(), Value::from(reason.as_str())); envelope.insert("note".to_string(), Value::from(note)); out.insert("meaning".to_string(), Value::Object(envelope)); }Ok(Value::Object(out))}/// One `[slug]` line per memory hit, batch-read: an assistant cites entries by/// slug, so a memory row without one is unusable as a reference.////// Schema v14 dropped `kind` and `layer`, so the detail line names what an/// assistant can still act on: whether the statement is about NOW (and so may/// have gone stale), where it briefs, and the `[slug]` to cite it by.fn memory_meta_for( ctx: &Ctx<'_>, hits: &[EverythingHit],) -> Result<HashMap<String, String>, ToolFailure> {letmut out = HashMap::new();let ids: Vec<String> = hits .iter() .filter(|hit| hit.kind == EverythingKind::Memory) .map(|hit| hit.id.clone()) .collect();if ids.is_empty() {returnOk(out); }let marks = vec!["?"; ids.len()].join(", ");let params: Vec<SqlValue> = ids.iter().map(|id| SqlValue::Text(id.clone())).collect();let rows = ctx .db() .all( &format!("SELECT id, slug, status FROM cotton_memories WHERE id IN ({marks})"), ¶ms, ) .map_err(|error| ToolFailure::new(error.to_string()))?;// Its homes: the link rows, not a column of its own.let links = ctx .db() .all( &format!("SELECT record_id, project_id FROM cotton_project_links WHERE record_kind = 'memory' AND record_id IN ({marks})" ), ¶ms, ) .map_err(|error| ToolFailure::new(error.to_string()))?;letmut project_ids: HashMap<String, Vec<String>> = HashMap::new();for link in &links {let (Some(record_id), Some(project_id)) = (link.text("record_id"), link.text("project_id"))else {continue; }; project_ids .entry(record_id.to_string()) .or_default() .push(project_id.to_string()); }let slug_by_project: HashMap<String, String> = if project_ids.is_empty() {HashMap::new() } else { projects(ctx)? .into_iter() .map(|project| (project.id, project.slug)) .collect() };for row in &rows {letSome(id) = row.text("id") else { continue };letmut parts: Vec<String> = Vec::new();let status = row.text("status").unwrap_or_default();if status != "active" && !status.is_empty() { parts.push(status.to_string()); }letmut homes: Vec<String> = project_ids .get(id) .map(|ids| { ids.iter() .filter_map(|project_id| slug_by_project.get(project_id).cloned()) .collect() }) .unwrap_or_default(); homes.sort(); parts.push(if homes.is_empty() {"no project".to_string() } else { homes.join(", ") }); parts.push(format!("[{}]", row.text("slug").unwrap_or_default())); out.insert(id.to_string(), parts.join(" · ")); }Ok(out)}/// The words for a hit whose record has no name of its own — the server's/// analogue of the app's `hitTitle`, in the assistant's register.fn nameless_title(hit: &EverythingHit) -> String {match hit.kind {// A journal page's identity IS its date.EverythingKind::Note => match (&hit.journal, &hit.when) { (true, Some(when)) => format!("Journal {}", when.chars().take(10).collect::<String>()), _ => "(untitled)".to_string(), },EverythingKind::Session => "(untitled session)".to_string(),EverythingKind::Transaction => "(transaction)".to_string(),// A repository always has a key and a release always has a tag, so// neither can be nameless — these are the words if one ever were,// rather than "(untitled)", which would read as a missing title on a// row whose title is its identity.EverythingKind::Repository => "(unnamed repository)".to_string(),EverythingKind::Release => "(untagged release)".to_string(), _ => "(untitled)".to_string(), }}#[cfg(test)]#[path = "search_tests.rs"]mod tests;