Skip to content
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

Remove doctype from search #5121

Merged
merged 5 commits into from
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,11 @@ def full_dash_path(self, version=LATEST):

def full_json_path(self, version=LATEST):
"""The path to the build json docs in the project."""
if 'sphinx' in self.documentation_type:
return os.path.join(self.conf_dir(version), '_build', 'json')

if 'mkdocs' in self.documentation_type:
return os.path.join(self.checkout_path(version), '_build', 'json')
json_path = os.path.join(
self.conf_dir(version),
'_build', 'json'
)
return json_path
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this is called from process_all_json_files

https://github.com/rtfd/readthedocs.org/blob/f06271b698d26734bf5024590948d41b1613b2e3/readthedocs/search/parse_json.py#L21-L26

And is used in os.walk, if the path doesn't exists (mkdocs for example), it doesn't raise an error, it just returns an empty iterator.


def full_singlehtml_path(self, version=LATEST):
"""The path to the build singlehtml docs in the project."""
Expand Down
13 changes: 4 additions & 9 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ def update_app_instances(self, html=False, localmedia=False, search=False,
callback=sync_callback.s(
version_pk=self.version.pk,
commit=self.build['commit'],
kwargs={'search': search},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ending up:

> /Users/eric/projects/readthedocs.org/readthedocs/projects/tasks.py(1395)sync_callback()
   1394     import ipdb; ipdb.set_trace()
-> 1395     if kwargs.get('search'):
   1396         update_search(version_pk, commit=commit)

ipdb> kwargs
{'kwargs': {'search': True}}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing in a push.

),
)

Expand Down Expand Up @@ -1010,14 +1011,7 @@ def update_search(version_pk, commit, delete_non_commit_files=True):
"""
version = Version.objects.get(pk=version_pk)

if 'sphinx' in version.project.documentation_type:
page_list = process_all_json_files(version, build_dir=False)
else:
log.debug(
'Unknown documentation type: %s',
version.project.documentation_type
)
return
page_list = process_all_json_files(version, build_dir=False)

log_msg = ' '.join([page['path'] for page in page_list])
log.info("(Search Index) Sending Data: %s [%s]", version.project.slug,
Expand Down Expand Up @@ -1350,7 +1344,8 @@ def sync_callback(_, version_pk, commit, *args, **kwargs):
The first argument is the result from previous tasks, which we discard.
"""
fileify(version_pk, commit=commit)
update_search(version_pk, commit=commit)
if kwargs.get('search'):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed bc the search code was updated too, but just in case.

update_search(version_pk, commit=commit)


@app.task()
Expand Down