-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add admin methods for reindexing versions from project and version admin. #5343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add admin methods for reindexing versions from project and version admin. #5343
Conversation
(comment #1 ) Same reason for not calling |
I apologise that this PR took too much time from my side. |
@dojutsu-user did you test this locally? I'm seeing it reindexing all projects. It looks like this happens when there is a version with no Refs #5357 |
readthedocs/projects/admin.py
Outdated
else: | ||
for version in active_versions.iterator(): | ||
html_objs = HTMLFile.objects.filter(project=project, version=version) | ||
_indexing_helper(html_objs, wipe=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reindexing a number of times, it should build a list of all the files and then pass it once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
I have made and pushed the changes.
If ``wipe`` is set to False, html_objs are deleted from the ES index, | ||
else, html_objs are indexed. | ||
""" | ||
from readthedocs.search.tasks import index_objects_to_es, delete_objects_in_es |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check if html_objs
exists -- it might not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the checks to prevent this.
I did tested this locally.
I have added multiple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
Related issue - #4654
Drop management command, these aren't good interfaces for site admins and are mostly hidden