Skip to content

Commit

Permalink
Re-introduce delete=False flag for search reindex in reindex_elastics…
Browse files Browse the repository at this point in the history
…earch command
  • Loading branch information
gregmuellegger committed Sep 25, 2015
1 parent 5e24a11 commit 1d422dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def handle(self, *args, **options):
commit = None

try:
update_search(version.pk, commit)
update_search(version.pk, commit,
delete_non_commit_files=False)
except Exception:
log.error('Reindex failed for %s' % version, exc_info=True)
4 changes: 3 additions & 1 deletion readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,12 @@ def move_files(version_pk, hostname, html=False, localmedia=False, search=False,


@task(queue='web')
def update_search(version_pk, commit):
def update_search(version_pk, commit, delete_non_commit_files=True):
"""Task to update search indexes
:param version_pk: Version id to update
:param commit: Commit that updated index
:param delete_non_commit_files: Delete files not in commit from index
"""
version = Version.objects.get(pk=version_pk)

Expand All @@ -642,6 +643,7 @@ def update_search(version_pk, commit):
# Don't index sections to speed up indexing.
# They aren't currently exposed anywhere.
section=False,
delete=delete_non_commit_files,
)


Expand Down

0 comments on commit 1d422dc

Please sign in to comment.