impl SearchProvider for WebSearchProvider {
type Result = SearchResult;
async fn search(&self, query: &str, options: &SearchOptions) -> Result<Vec<Self::Result>> {
Ok(vec![SearchResult {
title: "Example Crate".to_string(),
description: "Example description".to_string(),
url: "https://crates.io/example".to_string(),
relevance_score: 0.9,
}])
}
}
#[derive(Debug, Clone)]
pub struct SearchResult {
pub title: String,
pub description: String,
pub url: String,
pub relevance_score: f32,
}
#[derive(Clone)]
pub struct WebSearchProvider {
client: Arc<reqwest::Client>,
config: Arc<Config>,
}