in ees_sharepoint/deletion_sync_command.py [0:0]
def deindexing_sites(self, collection, ids):
"""Fetches the ids' of deleted sites from the sharepoint server and
invokes delete documents api for those ids to remove them from
workplace search
"""
logger = self.logger
site_details = ids["delete_keys"][collection].get("sites")
logger.info("Deindexing sites...")
if site_details:
doc = []
for site_id, site_url in site_details.items():
url = f"{site_url}/_api/web"
resp = self.sharepoint_client.get(url, '', "deindex")
if resp is not None and resp.status_code == requests.codes['not_found']:
doc.append(site_id)
for chunk in split_list_into_buckets(doc, BATCH_SIZE):
self.workplace_search_custom_client.delete_documents(
document_ids=chunk)
for site_id in doc:
ids["global_keys"][collection]["sites"].pop(site_id)
else:
logger.info("No sites found to be deleted for collection: %s" % collection)
return ids