diff --git a/backend/src/main/java/gc/mda/kcg/collector/osint/OsintCollector.java b/backend/src/main/java/gc/mda/kcg/collector/osint/OsintCollector.java index 91952a5..386c067 100644 --- a/backend/src/main/java/gc/mda/kcg/collector/osint/OsintCollector.java +++ b/backend/src/main/java/gc/mda/kcg/collector/osint/OsintCollector.java @@ -118,8 +118,7 @@ public class OsintCollector { if (articleUrl == null || title == null || title.isBlank()) continue; if (osintFeedRepository.existsBySourceAndSourceUrl("gdelt", articleUrl)) continue; - if (osintFeedRepository.existsByRegionAndTitleAndCollectedAtAfter( - region, title, Instant.now().minus(24, ChronoUnit.HOURS))) continue; + if (osintFeedRepository.existsByTitle(title)) continue; String seendate = article.path("seendate").asText(null); Instant publishedAt = parseGdeltDate(seendate); @@ -184,8 +183,7 @@ public class OsintCollector { if (link == null || title == null || title.isBlank()) continue; if (osintFeedRepository.existsBySourceAndSourceUrl(sourceName, link)) continue; - if (osintFeedRepository.existsByRegionAndTitleAndCollectedAtAfter( - region, title, Instant.now().minus(24, ChronoUnit.HOURS))) continue; + if (osintFeedRepository.existsByTitle(title)) continue; Instant publishedAt = parseRssDate(pubDate); diff --git a/backend/src/main/java/gc/mda/kcg/domain/osint/OsintFeedRepository.java b/backend/src/main/java/gc/mda/kcg/domain/osint/OsintFeedRepository.java index b87a231..d3355aa 100644 --- a/backend/src/main/java/gc/mda/kcg/domain/osint/OsintFeedRepository.java +++ b/backend/src/main/java/gc/mda/kcg/domain/osint/OsintFeedRepository.java @@ -9,7 +9,7 @@ public interface OsintFeedRepository extends JpaRepository { boolean existsBySourceAndSourceUrl(String source, String sourceUrl); - boolean existsByRegionAndTitleAndCollectedAtAfter(String region, String title, Instant since); + boolean existsByTitle(String title); List findByRegionAndCollectedAtAfterOrderByPublishedAtDesc(String region, Instant since); }