pub mod arxiv;
pub mod backend_selector;
pub mod brave;
pub mod dedup;
pub mod duckduckgo;
pub mod exa;
pub mod fallback;
pub mod firecrawl;
pub mod github;
pub mod hackernews;
pub mod latency;
pub mod orchestrator;
pub mod reddit;
pub mod searxng;
pub mod serper;
pub mod stackoverflow;
pub mod tavily;
pub mod wikipedia;
pub use backend_selector::{AbsConfig, AdaptiveBackendSelector, BackendSelection};
pub use latency::{LatencyConfig, LatencyPredictor, LatencyStats};
pub mod bing;
pub mod google;
pub mod scholar;
use crate::error::FetchiumResult;
use crate::rank::fusion::QueryIntent;
use crate::types::{BackendId, ResultItem};
use async_trait::async_trait;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TimeRange {
Day,
Week,
Month,
Year,
}
#[derive(Debug, Clone)]
pub struct SearchContext {
pub intent: QueryIntent,
pub time_range: Option<TimeRange>,
pub locale: Option<String>,
pub language: Option<String>,
}
#[async_trait]
pub trait SearchBackend: Send + Sync {
fn id(&self) -> BackendId;
fn requires_headless(&self) -> bool {
false
}
async fn search(&self, query: &str, max_results: u32) -> FetchiumResult<Vec<ResultItem>>;
async fn search_with_context(
&self,
query: &str,
max_results: u32,
_ctx: &SearchContext,
) -> FetchiumResult<Vec<ResultItem>> {
self.search(query, max_results).await
}
}