Skip to content

Commit 5e2c3ac

Browse files
committed
search: reinstate the relationship mapping in the index
1 parent 17908d3 commit 5e2c3ac

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

readthedocs/search/indexes.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ def get_mapping(self):
266266
self._type: {
267267
# Disable _all field to reduce index size.
268268
'_all': {'enabled': False},
269-
# Associate a page with a project.
270-
# '_parent': {'type': self._parent},
271269
'properties': {
272270
'id': {'type': 'keyword'},
273271
'sha': {'type': 'keyword'},
@@ -282,6 +280,13 @@ def get_mapping(self):
282280
'content': {'type': 'text', 'analyzer': 'default_icu'},
283281
# Add a weight field to enhance relevancy scoring.
284282
'weight': {'type': 'float'},
283+
# Associate a page with a project.
284+
self._parent: {
285+
'type': 'join',
286+
'relations': {
287+
self._parent: self._type
288+
}
289+
},
285290
}
286291
}
287292
}
@@ -314,8 +319,6 @@ def get_mapping(self):
314319
self._type: {
315320
# Disable _all field to reduce index size.
316321
'_all': {'enabled': False},
317-
# Associate a section with a page.
318-
# '_parent': {'type': self._parent},
319322
# Commenting this out until we need it.
320323
# 'suggest': {
321324
# "type": "completion",
@@ -340,6 +343,13 @@ def get_mapping(self):
340343
},
341344
# Add a weight field to enhance relevancy scoring.
342345
'weight': {'type': 'float'},
346+
# Associate a section with a page.
347+
self._parent: {
348+
'type': 'join',
349+
'relations': {
350+
self._parent: self._type
351+
}
352+
},
343353
}
344354
}
345355
}

0 commit comments

Comments
 (0)