Skip to content

Commit 0ed64f7

Browse files
committed
fix sphinx indexing
1 parent ed16e56 commit 0ed64f7

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

readthedocs/projects/tasks.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,13 +1282,8 @@ def fileify(version_pk, commit, build):
12821282
except Exception:
12831283
log.exception('Failed during ImportedFile creation')
12841284

1285-
try:
1286-
_update_intersphinx_data(version, path, commit, build)
1287-
except Exception:
1288-
log.exception('Failed during SphinxDomain creation')
1289-
12901285

1291-
def _update_intersphinx_data(version, path, commit, build):
1286+
def _create_intersphinx_data(version, path, commit, build):
12921287
"""
12931288
Update intersphinx data for this version.
12941289
@@ -1376,24 +1371,6 @@ def warn(self, msg):
13761371
build=build,
13771372
)
13781373

1379-
# Index new SphinxDomain objects to elasticsearch
1380-
index_new_files(model=SphinxDomain, version=version, build=build)
1381-
1382-
# Remove old SphinxDomain from elasticsearch
1383-
remove_indexed_files(
1384-
model=SphinxDomain,
1385-
version=version,
1386-
build=build,
1387-
)
1388-
1389-
# Delete SphinxDomain objects from the previous build of the version.
1390-
(
1391-
SphinxDomain.objects
1392-
.filter(project=version.project, version=version)
1393-
.exclude(build=build)
1394-
.delete()
1395-
)
1396-
13971374

13981375
def clean_build(version_pk):
13991376
"""Clean the files used in the build of the given version."""
@@ -1481,6 +1458,12 @@ def _manage_imported_files(version, path, commit, build):
14811458
build=build,
14821459
)
14831460

1461+
# create SphinxDomain objects
1462+
try:
1463+
_create_intersphinx_data(version, path, commit, build)
1464+
except Exception:
1465+
log.exception('Failed during SphinxDomain objects creation')
1466+
14841467
# Index new HTMLFiles to elasticsearch
14851468
index_new_files(model=HTMLFile, version=version, build=build)
14861469

readthedocs/search/documents.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ class Meta:
111111

112112
def prepare_domains(self, html_file):
113113
"""Prepares and returns the values for domains field."""
114-
domains_qs = html_file.sphinx_domains.all().iterator()
115-
domains_qs = domains_qs.exclude(domain='std', type__in=['doc', 'label'])
114+
domains_qs = html_file.sphinx_domains.exclude(
115+
domain='std',
116+
type__in=['doc', 'label']
117+
).iterator()
116118

117119
all_domains = [{
118120
'role_name': domain.role_name,

0 commit comments

Comments
 (0)