Skip to content

Commit

Permalink
Fix CKAN harvester search functionality
Browse files Browse the repository at this point in the history
- Now return results of all pages, not only the first x rows.
  • Loading branch information
mjanez committed Jul 31, 2024
1 parent 3beccce commit 3952322
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ckanext/schemingdcat/harvesters/ckan.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,11 @@ def _search_for_datasets(self, remote_ckan_base_url, fq_terms=None):
pkg_dicts = []
pkg_ids = set()
previous_content = None
url = base_search_url + "?" + urlencode(params)
log.debug("Searching for CKAN datasets: %s", url)

while True:
url = base_search_url + "?" + urlencode(params)
log.debug("Searching for CKAN datasets: %s", url)

try:
content = self._get_content(url)
except ContentFetchError as e:
Expand Down Expand Up @@ -429,6 +430,8 @@ def _search_for_datasets(self, remote_ckan_base_url, fq_terms=None):

params["start"] = str(int(params["start"]) + int(params["rows"]))

log.debug('Number of elements in remote CKAN: %s', len(pkg_dicts))

return pkg_dicts

def fetch_stage(self, harvest_object):
Expand Down

0 comments on commit 3952322

Please sign in to comment.