File tree 4 files changed +14
-6
lines changed
4 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -1254,7 +1254,8 @@ def get_processed_json(self):
1254
1254
return {
1255
1255
'headers' : [],
1256
1256
'content' : '' ,
1257
- 'path' : self .path ,
1257
+ 'path' : file_path ,
1258
+ 'full_path' : self .path ,
1258
1259
'title' : '' ,
1259
1260
'sections' : [],
1260
1261
}
Original file line number Diff line number Diff line change @@ -42,15 +42,14 @@ def get_link(self, obj):
42
42
projects_url = self .context .get ('projects_url' )
43
43
if projects_url :
44
44
docs_url = projects_url [obj .project ]
45
- path = os .path .splitext (obj .path )[0 ]
46
- return docs_url + path
45
+ return docs_url + obj .path
47
46
48
47
def get_url (self , obj ):
49
48
"""Gets the full url."""
50
49
projects_url = self .context .get ('projects_url' )
51
50
if projects_url :
52
51
docs_url = projects_url [obj .project ]
53
- return docs_url + obj .path
52
+ return docs_url + obj .full_path
54
53
55
54
def get_highlight (self , obj ):
56
55
highlight = getattr (obj .meta , 'highlight' , None )
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ class PageDocument(RTDDocTypeMixin, DocType):
116
116
project = fields .KeywordField (attr = 'project.slug' )
117
117
version = fields .KeywordField (attr = 'version.slug' )
118
118
path = fields .KeywordField (attr = 'processed_json.path' )
119
+ full_path = fields .KeywordField (attr = 'processed_json.full_path' )
119
120
120
121
# Searchable content
121
122
title = fields .TextField (attr = 'processed_json.title' )
@@ -153,7 +154,7 @@ def faceted_search(
153
154
154
155
def get_queryset (self ):
155
156
"""Overwrite default queryset to filter certain files to index."""
156
- queryset = super (PageDocument , self ).get_queryset ()
157
+ queryset = super ().get_queryset ()
157
158
158
159
# Do not index files that belong to non sphinx project
159
160
# Also do not index certain files
Original file line number Diff line number Diff line change @@ -69,9 +69,15 @@ def process_file(fjson_filename, filename):
69
69
raise
70
70
data = json .loads (file_contents )
71
71
sections = []
72
+ path = ''
72
73
title = ''
73
74
body_content = ''
74
75
76
+ if 'current_page_name' in data :
77
+ path = data ['current_page_name' ]
78
+ else :
79
+ log .info ('Unable to index file due to no name %s' , filename )
80
+
75
81
if data .get ('body' ):
76
82
body = PyQuery (data ['body' ])
77
83
body_content = body .text ().replace ('¶' , '' )
@@ -89,7 +95,8 @@ def process_file(fjson_filename, filename):
89
95
return {
90
96
'headers' : process_headers (data , fjson_filename ),
91
97
'content' : body_content ,
92
- 'path' : filename ,
98
+ 'path' : path ,
99
+ 'full_path' : filename ,
93
100
'title' : title ,
94
101
'sections' : sections ,
95
102
}
You can’t perform that action at this time.
0 commit comments