From 517dd2d887fc5322cb3dee79431d6b23de9aa15c Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 16 Jan 2019 12:17:43 -0500 Subject: [PATCH 1/2] Remove doctype from search --- readthedocs/projects/models.py | 10 +++++----- readthedocs/projects/tasks.py | 13 ++++--------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/readthedocs/projects/models.py b/readthedocs/projects/models.py index f4fdea8f0ba..1128e82b09a 100644 --- a/readthedocs/projects/models.py +++ b/readthedocs/projects/models.py @@ -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 def full_singlehtml_path(self, version=LATEST): """The path to the build singlehtml docs in the project.""" diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 5daa35b4e62..6218f84fdfe 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -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}, ), ) @@ -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, @@ -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'): + update_search(version_pk, commit=commit) @app.task() From 9d9947a850050afdb8d7f4669fb3a306d089efbc Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 22 Jan 2019 09:59:54 -0500 Subject: [PATCH 2/2] Fix kwarg passing to search --- readthedocs/projects/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 2187c286c2e..02dc628503d 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -741,7 +741,7 @@ def update_app_instances( callback=sync_callback.s( version_pk=self.version.pk, commit=self.build['commit'], - kwargs={'search': search}, + search=search, ), )