misc: remove external links from search index when --remove is given (#28160)

This commit is contained in:
Frédéric Péters 2018-11-19 20:32:24 +01:00
parent 799780447e
commit 00e38a7187
1 changed files with 5 additions and 2 deletions

View File

@ -35,12 +35,15 @@ class Command(UpdateIndexCommand):
# do not index site if there's no matching search cell
return
if not options.get('skip_external_links_collection', False):
self.collect_external_links()
self.collect_external_links(options)
return super(Command, self).handle(**options)
def collect_external_links(self):
def collect_external_links(self, options):
start_time = now()
if options.get('remove'):
ExternalLinkSearchItem.objects.all().delete()
# assemble external links data
links = {}
for page in Page.objects.all():