Struct IndexerService

Source
pub struct IndexerService {
    config: Arc<Config>,
    storage_service: Arc<StorageService>,
    search_service: Arc<SearchService>,
    client: Client,
    force_process_flag: Arc<AtomicBool>,
}

Fields§

§config: Arc<Config>§storage_service: Arc<StorageService>§search_service: Arc<SearchService>§client: Client§force_process_flag: Arc<AtomicBool>

Implementations§

Source§

impl IndexerService

Source

fn url_to_id(url: &str) -> String

Generate a deterministic ID from a URL to prevent duplicate crawl items

Source

pub async fn new( config: Arc<Config>, storage_service: Arc<StorageService>, search_service: Arc<SearchService>, ) -> Result<Self>

Source

pub async fn queue_domains(&self, domains: &[String]) -> Result<usize>

Queue domains for crawling

Source

pub async fn queue_domains_with_check( &self, domains: &[String], check_last_indexed: bool, ) -> Result<usize>

Queue domains for crawling with optional last-indexed time checking If check_last_indexed is true, domains that were indexed recently will be skipped

Source

pub async fn start_periodic_indexing(&self) -> Result<()>

Start the periodic indexing service that checks for stale domains and re-indexes them This runs in a loop, checking every 6 hours for domains that need re-indexing

Source

pub async fn start_periodic_duplicate_removal(&self) -> Result<()>

Start the periodic duplicate removal service This runs in a loop, checking for and removing duplicates at configured intervals

Source

pub fn trigger_force_process_queue(&self) -> Result<()>

Trigger immediate queue processing by setting the force flag

Source

async fn check_and_queue_stale_domains(&self) -> Result<usize>

Source

pub async fn process_crawl_queue(&self) -> Result<()>

Source

async fn log_crawl_queue_status( &self, items_processed: usize, total_time: Duration, )

Log detailed crawl queue status for monitoring

Source

async fn process_crawl_item( item: CrawlQueue, storage_service: Arc<StorageService>, search_service: Arc<SearchService>, config: Arc<Config>, client: Client, ) -> Result<()>

Source

async fn crawl_and_index_page( item: &CrawlQueue, storage_service: &Arc<StorageService>, search_service: &Arc<SearchService>, config: &Arc<Config>, client: &Client, ) -> Result<()>

Source

fn extract_text_content(document: &Html) -> String

Source

fn extract_text_recursive(element: ElementRef<'_>, text_parts: &mut Vec<String>)

Source

fn generate_snippet(content: &str, max_length: usize) -> String

Source

async fn is_allowed_by_robots( url: &str, _user_agent: &str, client: &Client, ) -> Result<bool>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,