//! # Event Filtering Module //! //! Advanced event search and filtering capabilities with faceted search, internationalization, //! and caching integration for high-performance event discovery. //! //! This module provides a comprehensive filtering system that allows users to discover events //! based on multiple criteria including location, time, event type, and custom attributes. //! The system is designed for performance with intelligent caching and optimized database queries. //! //! ## Architecture //! //! The filtering system is organized around several key components: //! //! ### Core Components //! - **[`service`]** - Main filtering service with caching and coordination //! - **[`query_builder`]** - SQL query construction for complex filtering operations //! - **[`criteria`]** - Filter criteria definition and validation //! - **[`facets`]** - Faceted search functionality for guided discovery //! //! ### Support Systems //! - **[`hydration`]** - Result enrichment with additional data and i18n //! - **[`errors`]** - Filtering-specific error handling and user feedback //! //! ## Features //! //! ### Faceted Search //! Multi-dimensional filtering with dynamic facet generation: //! - **Location Facets** - Geographic regions, cities, venues //! - **Time Facets** - Date ranges, time of day, duration //! - **Category Facets** - Event types, topics, target audiences //! - **Status Facets** - Event status (scheduled, cancelled, etc.) //! - **Dynamic Facets** - Generated based on current result set //! //! ### Performance Optimization //! - **Query Optimization** - Efficient SQL generation with proper indexing //! - **Result Caching** - Redis-based caching of frequently accessed filters //! - **Pagination** - Memory-efficient handling of large result sets //! - **Incremental Loading** - Progressive result enhancement //! //! ### Internationalization //! - **Localized Facets** - Facet names and values in user's language //! - **Geographic Localization** - Location names in appropriate language //! - **Time Zone Support** - Automatic time zone conversion for events //! - **Cultural Formatting** - Date and time formatting per locale //! //! ### Search Capabilities //! - **Full-Text Search** - Content search across event titles and descriptions //! - **Fuzzy Matching** - Tolerance for spelling variations and typos //! - **Synonym Support** - Expanded search with related terms //! - **Stemming** - Language-appropriate word stemming //! //! ## Filter Types //! //! ### Geographic Filters //! - **Radius Search** - Events within specified distance //! - **Bounding Box** - Events within rectangular area //! - **Administrative** - City, state, country-based filtering //! - **Venue Type** - Indoor, outdoor, virtual venue classification //! //! ### Temporal Filters //! - **Date Range** - Events within specific date spans //! - **Time of Day** - Morning, afternoon, evening events //! - **Duration** - Short, medium, long-duration events //! - **Recurrence** - One-time vs. recurring events //! //! ### Content Filters //! - **Category** - Event category and subcategory //! - **Tags** - User-defined and system-generated tags //! - **Language** - Event content language //! - **Accessibility** - Accessibility features and requirements //! //! ## Example Usage //! //! ```rust,no_run //! use smokesignal::filtering::{service::FilteringService, criteria::FilterCriteria}; //! use chrono::{DateTime, Utc}; //! //! async fn search_events() -> anyhow::Result<()> { //! let filtering_service = FilteringService::new(pool, cache).await?; //! //! // Create filter criteria //! let criteria = FilterCriteria::builder() //! .location_radius(40.7128, -74.0060, 10.0) // 10km around NYC //! .date_range( //! DateTime::::from_timestamp(1640995200, 0).unwrap(), //! DateTime::::from_timestamp(1672531200, 0).unwrap() //! ) //! .categories(vec!["technology", "networking"]) //! .language("en-US") //! .build()?; //! //! // Perform search with facets //! let results = filtering_service.search_events(criteria, true).await?; //! //! println!("Found {} events", results.events.len()); //! for facet in results.facets { //! println!("Facet {}: {} options", facet.name, facet.values.len()); //! } //! //! Ok(()) //! } //! ``` //! //! ## Caching Strategy //! //! The filtering system uses a multi-layered caching approach: //! - **Query Result Cache** - Cached search results for common queries //! - **Facet Cache** - Pre-computed facet values for popular filters //! - **Metadata Cache** - Event metadata and enrichment data //! - **User Cache** - Personalized filter preferences and history pub mod criteria; pub mod errors; pub mod facets; pub mod hydration; pub mod query_builder; pub mod service; #[cfg(test)] mod cache_integration_test; #[cfg(test)] mod mode_status_integration_test; #[cfg(test)] mod i18n_integration_test; pub use criteria::*; pub use errors::*; pub use facets::*; pub use hydration::*; pub use query_builder::*; pub use service::*; /// Filter context for passing common dependencies #[derive(Debug, Clone)] pub struct FilterContext { pub pool: crate::storage::StoragePool, pub language: crate::http::middleware_i18n::Language, } impl FilterContext { pub fn new(pool: crate::storage::StoragePool, language: crate::http::middleware_i18n::Language) -> Self { Self { pool, language } } }