Skip to content

Commit b47f60e

Browse files
committed
Update reindex_organisations to retrieve 3000 rows for checking existence
1 parent eacb786 commit b47f60e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ckanext/datagovuk/lib/cli.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def reindex_organisations(context):
395395
solr = pysolr.Solr(os.getenv('CKAN_SOLR_URL'), always_commit=True, timeout=10)
396396
solr.ping()
397397

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

@@ -426,12 +426,9 @@ def reindex_organisations(context):
426426
if organisations:
427427
solr.add(organisations)
428428

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

431-
print(f"Retrieved {len(results)} results")
432-
433-
for result in results:
434-
print(f"{result.get('title')} - {result.get('name')}")
431+
print(f"Added {len(organisations)} organisations, total numer = {len(results)}")
435432

436433

437434
def run_command(command):

0 commit comments

Comments
 (0)