misc: remove external links from search index when --remove is given (#28160)
This commit is contained in:
parent
799780447e
commit
00e38a7187
|
@ -35,12 +35,15 @@ class Command(UpdateIndexCommand):
|
||||||
# do not index site if there's no matching search cell
|
# do not index site if there's no matching search cell
|
||||||
return
|
return
|
||||||
if not options.get('skip_external_links_collection', False):
|
if not options.get('skip_external_links_collection', False):
|
||||||
self.collect_external_links()
|
self.collect_external_links(options)
|
||||||
return super(Command, self).handle(**options)
|
return super(Command, self).handle(**options)
|
||||||
|
|
||||||
def collect_external_links(self):
|
def collect_external_links(self, options):
|
||||||
start_time = now()
|
start_time = now()
|
||||||
|
|
||||||
|
if options.get('remove'):
|
||||||
|
ExternalLinkSearchItem.objects.all().delete()
|
||||||
|
|
||||||
# assemble external links data
|
# assemble external links data
|
||||||
links = {}
|
links = {}
|
||||||
for page in Page.objects.all():
|
for page in Page.objects.all():
|
||||||
|
|
Loading…
Reference in New Issue