pub struct AdaptiveStrategy { /* private fields */ }Expand description
Adaptive crawling strategy that stops when content saturation is detected.
Tracks the number of new unique terms discovered per page. When the rate of new term discovery drops below a configurable threshold (term saturation), the strategy signals the engine to stop crawling.
Implementations§
Source§impl AdaptiveStrategy
impl AdaptiveStrategy
Sourcepub fn new(window_size: usize, saturation_threshold: f64) -> Self
pub fn new(window_size: usize, saturation_threshold: f64) -> Self
Create a new adaptive strategy.
window_size: Number of recent pages for saturation window (default: 10)saturation_threshold: Stop when new terms per page ratio drops below this (default: 0.05)
Sourcepub fn record_page(&self, html: &str)
pub fn record_page(&self, html: &str)
Record a page’s content for saturation tracking.
Trait Implementations§
Source§impl CrawlStrategy for AdaptiveStrategy
impl CrawlStrategy for AdaptiveStrategy
Source§fn select_next(&self, candidates: &[FrontierEntry]) -> Option<usize>
fn select_next(&self, candidates: &[FrontierEntry]) -> Option<usize>
Select the next URL to crawl from a set of candidates.
Returns the index into
candidates, or None if none should be selected.Source§fn should_continue(&self, stats: &CrawlStats) -> bool
fn should_continue(&self, stats: &CrawlStats) -> bool
Whether the crawl should continue given current stats.
Source§fn on_page_processed(&self, page: &CrawlPageResult)
fn on_page_processed(&self, page: &CrawlPageResult)
Called after each page is processed. Used by adaptive strategies to track content.
Source§impl Debug for AdaptiveStrategy
impl Debug for AdaptiveStrategy
Auto Trait Implementations§
impl !Freeze for AdaptiveStrategy
impl RefUnwindSafe for AdaptiveStrategy
impl Send for AdaptiveStrategy
impl Sync for AdaptiveStrategy
impl Unpin for AdaptiveStrategy
impl UnsafeUnpin for AdaptiveStrategy
impl UnwindSafe for AdaptiveStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more