in ees_sharepoint/deletion_sync_command.py [0:0]
def deindexing_lists(self, collection, ids):
"""Fetches the id's of deleted lists from the sharepoint server and
further removes them from workplace search by invoking the delete
document api.
Returns:
sites: list of site paths
"""
logger = self.logger
delete_ids_lists = ids["delete_keys"][collection].get('lists')
logger.info("Deindexing lists...")
if delete_ids_lists:
delete = []
global_ids_lists = ids["global_keys"][collection]["lists"]
for site_url, list_details in delete_ids_lists.items():
doc = []
for list_id in list_details.keys():
url = f"{site_url}/_api/web/lists(guid\'{list_id}\')"
resp = self.sharepoint_client.get(url, '', "deindex")
if resp is not None and resp.status_code == requests.codes['not_found']:
doc.append(list_id)
for chunk in split_list_into_buckets(doc, BATCH_SIZE):
self.workplace_search_custom_client.delete_documents(
document_ids=chunk)
for list_id in doc:
if list_id in global_ids_lists[site_url]:
global_ids_lists[site_url].pop(list_id)
if global_ids_lists[site_url] == {}:
delete.append(site_url)
for site_url in delete:
global_ids_lists.pop(site_url)
else:
logger.info("No list found to be deleted for collection: %s" % collection)
return ids