From b25d13427a9417cc8accae4bf0ce61f7d1ed96cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 1 Nov 2024 16:17:55 +0100 Subject: [PATCH] chg: Show more of the recent captures for some indexes --- lookyloo/indexing.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lookyloo/indexing.py b/lookyloo/indexing.py index 9b3ebfa3..7c9f8968 100644 --- a/lookyloo/indexing.py +++ b/lookyloo/indexing.py @@ -227,10 +227,10 @@ class Indexing(): :param cookie_name: The cookie name :param most_recent_capture: The capture time of the most recent capture to consider - :param oldest_capture: The capture time of the oldest capture to consider, defaults to 15 days ago. + :param oldest_capture: The capture time of the oldest capture to consider, defaults to 20 days ago. """ max_score: str | float = most_recent_capture.timestamp() if most_recent_capture else '+Inf' - min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=15)).timestamp() + min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=20)).timestamp() if self.redis.type(f'cookies_names|{cookie_name}|captures') == 'set': # type: ignore[no-untyped-call] # triggers the re-index soon. self.redis.srem('indexed_cookies', *[entry.split('|')[0] for entry in self.redis.smembers(f'cn|{cookie_name}|captures')]) @@ -663,10 +663,10 @@ class Indexing(): :param favicon_sha512: The favicon hash :param most_recent_capture: The capture time of the most recent capture to consider - :param oldest_capture: The capture time of the oldest capture to consider, defaults to 15 days ago. + :param oldest_capture: The capture time of the oldest capture to consider, defaults to 30 days ago. """ max_score: str | float = most_recent_capture.timestamp() if most_recent_capture else '+Inf' - min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=15)).timestamp() + min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=30)).timestamp() return self.redis.zrevrangebyscore(f'favicons|{favicon_sha512}|captures', max_score, min_score, withscores=True) def get_captures_favicon_count(self, favicon_sha512: str) -> int: @@ -769,10 +769,10 @@ class Indexing(): :param hash_type: The type of hash :param h: The hash :param most_recent_capture: The capture time of the most recent capture to consider - :param oldest_capture: The capture time of the oldest capture to consider, defaults to 5 days ago. + :param oldest_capture: The capture time of the oldest capture to consider, defaults to 20 days ago. """ max_score: str | float = most_recent_capture.timestamp() if most_recent_capture else '+Inf' - min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=5)).timestamp() + min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=20)).timestamp() return self.redis.zrevrangebyscore(f'capture_hash_types|{hash_type}|{h}|captures', max_score, min_score, withscores=True) def get_captures_hash_type_count(self, hash_type: str, h: str) -> int: @@ -850,10 +850,10 @@ class Indexing(): :param identifier_type: The type of identifier :param identifier: The identifier :param most_recent_capture: The capture time of the most recent capture to consider - :param oldest_capture: The capture time of the oldest capture to consider, defaults to 5 days ago. + :param oldest_capture: The capture time of the oldest capture to consider, defaults to 30 days ago. """ max_score: str | float = most_recent_capture.timestamp() if most_recent_capture else '+Inf' - min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=5)).timestamp() + min_score: str | float = oldest_capture.timestamp() if oldest_capture else (datetime.now() - timedelta(days=30)).timestamp() if self.redis.type(f'identifiers|{identifier_type}|{identifier}|captures') == 'set': # type: ignore[no-untyped-call] # triggers the re-index soon. self.redis.srem('indexed_identifiers', *self.redis.smembers(f'identifiers|{identifier_type}|{identifier}|captures'))