From a82aa340ac64009a2e8348e99b9c25a3962b2ab9 Mon Sep 17 00:00:00 2001 From: velsl Date: Tue, 23 Apr 2024 16:02:09 +0200 Subject: [PATCH 1/2] extra check op aantal records vanwege bug in GetRecords GeoNetwork --- ngr_spider/csw_client.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ngr_spider/csw_client.py b/ngr_spider/csw_client.py index e800a52..c575719 100644 --- a/ngr_spider/csw_client.py +++ b/ngr_spider/csw_client.py @@ -32,7 +32,7 @@ def _get_csw_records( self, query: str, maxresults: int = 0, no_filter: bool = False ) -> list[CswServiceRecord]: csw = CatalogueServiceWeb(self.csw_url) - + print(query) while True: result: list[CswServiceRecord] = [] start = 1 @@ -49,14 +49,15 @@ def _get_csw_records( ) if start == 1: matched = csw.results["matches"] - LOGGER.info("Number of matched servcies before filtering: " + str(matched)) + LOGGER.info("Number of matched services before filtering: " + str(matched)) elif matched != csw.results["matches"]: - LOGGER.info("Number of matched servcies has been changed: old = " + str(matched) + ", new = " + str(csw.results["matches"])) + LOGGER.info("Number of matched services has been changed: old = " + str(matched) + ", new = " + str(csw.results["matches"])) break # inner loop records = [CswServiceRecord(rec[1].xml) for rec in csw.records.items()] result.extend(records) - if csw.results["nextrecord"] != 0 and (maxresults == 0 or len(result) < maxresults): + # extra check op aantal records groter dan nextrecord vanwege bug in GeoNetwork + if (csw.results["nextrecord"] != 0 and csw.results["nextrecord"] < csw.results["matches"]) and (maxresults == 0 or len(result) < maxresults): start = csw.results["nextrecord"] continue result_out: list[CswServiceRecord] = result From 6c0b12321351c3ea4ff3f34522eeceea6c692cb9 Mon Sep 17 00:00:00 2001 From: velsl Date: Tue, 23 Apr 2024 16:04:29 +0200 Subject: [PATCH 2/2] review commentaar verwerkt --- ngr_spider/csw_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ngr_spider/csw_client.py b/ngr_spider/csw_client.py index c575719..644eda6 100644 --- a/ngr_spider/csw_client.py +++ b/ngr_spider/csw_client.py @@ -32,7 +32,6 @@ def _get_csw_records( self, query: str, maxresults: int = 0, no_filter: bool = False ) -> list[CswServiceRecord]: csw = CatalogueServiceWeb(self.csw_url) - print(query) while True: result: list[CswServiceRecord] = [] start = 1