web_search/types.rs
1//! Core data types shared by merging and network-backed search.
2
3use serde::{Deserialize, Serialize};
4
5/// A single search result.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct SearchResult {
8 /// The title of the search result.
9 pub title: String,
10 /// The URL of the search result.
11 pub url: String,
12 /// The description/snippet of the search result.
13 pub snippet: String,
14 /// The search provider that returned this result.
15 pub source: String,
16 /// The rank position in the original results (1-based).
17 pub rank: usize,
18 /// Computed score after merging (optional).
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub score: Option<f64>,
21 /// Sources that returned this result (after deduplication).
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub sources: Option<Vec<String>>,
24}