Skip to content

Commit

Permalink
Merge pull request #1919 from alphagov/update-reindex_organisations
Browse files Browse the repository at this point in the history
Update reindex_organisations to retrieve 3000 rows for checking existence
  • Loading branch information
kentsanggds authored Jan 9, 2025
2 parents 91ee28d + 4cfb397 commit 99579af
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ckanext/datagovuk/lib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def reindex_organisations(context):
solr = pysolr.Solr(os.getenv('CKAN_SOLR_URL'), always_commit=True, timeout=10)
solr.ping()

existing_organisations = [r.get('name') for r in solr.search("*", fq="(site_id:dgu_organisations)")]
existing_organisations = [r.get('name') for r in solr.search("*", fq="(site_id:dgu_organisations)", rows=3000)]
organisations = []
counter = 0

Expand Down Expand Up @@ -426,12 +426,9 @@ def reindex_organisations(context):
if organisations:
solr.add(organisations)

results = solr.search("*", fq="(site_id:dgu_organisations)", rows=2000)
results = solr.search("*", fq="(site_id:dgu_organisations)", rows=3000)

print(f"Retrieved {len(results)} results")

for result in results:
print(f"{result.get('title')} - {result.get('name')}")
print(f"Added {len(organisations)} organisations, total number = {len(results)}")


def run_command(command):
Expand Down

0 comments on commit 99579af

Please sign in to comment.