Preserve tags for index-only adds

This commit is contained in:
Nick Sweeting
2026-03-15 04:54:55 -07:00
parent 58f801c220
commit cc3e72b92f

View File

@@ -109,7 +109,7 @@ def add(urls: str | list[str],
print('[yellow]\\[*] Index-only mode - crawl created but not started[/yellow]') print('[yellow]\\[*] Index-only mode - crawl created but not started[/yellow]')
# Create snapshots for all URLs in the crawl # Create snapshots for all URLs in the crawl
for url in crawl.get_urls_list(): for url in crawl.get_urls_list():
Snapshot.objects.update_or_create( snapshot, _ = Snapshot.objects.update_or_create(
crawl=crawl, url=url, crawl=crawl, url=url,
defaults={ defaults={
'status': Snapshot.INITIAL_STATE, 'status': Snapshot.INITIAL_STATE,
@@ -118,6 +118,8 @@ def add(urls: str | list[str],
'depth': 0, 'depth': 0,
}, },
) )
if tag:
snapshot.save_tags(tag.split(','))
return crawl.snapshot_set.all() return crawl.snapshot_set.all()
# 5. Start the orchestrator to process the queue # 5. Start the orchestrator to process the queue