Skip to content

Commit b603010

Browse files
committed
test new engine
1 parent 817bf01 commit b603010

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

docusaurus.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ const config = {
174174
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
175175
({
176176
algolia: {
177-
appId: '62VCH2MD74',
178-
apiKey: '2363bec2ff1cf20b0fcac675040107c3',
177+
appId: '5H9UG7CX5W',
178+
apiKey: '4a7bf25cf3edbef29d78d5e1eecfdca5',
179179
indexName: 'clickhouse',
180180
contextualSearch: false,
181181
searchPagePath: 'search',

scripts/search/index_pages.py

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,22 @@ def parse_markdown_content(metadata, content):
206206
heading_slug = slug
207207
lines = content.splitlines()
208208
current_h1 = metadata.get('title', '')
209+
current_h2 = None
210+
current_h3 = None
211+
current_h4 = None
209212
current_subdoc = {
210213
'file_path': metadata.get('file_path', ''),
211214
'slug': heading_slug,
212215
'url': f'{DOCS_SITE}{heading_slug}',
213216
'h1': current_h1,
214-
'content': metadata.get('description', ''),
215217
'title': metadata.get('title', ''),
218+
'content': metadata.get('description', ''),
216219
'keywords': metadata.get('keywords', ''),
217220
'objectID': get_object_id(heading_slug),
221+
'type': 'lvl0',
222+
'hierarchy': {
223+
'lvl0': metadata.get('title', '')
224+
}
218225
}
219226
for line in lines:
220227
if line.startswith('# '):
@@ -227,7 +234,10 @@ def parse_markdown_content(metadata, content):
227234
current_subdoc['slug'] = heading_slug
228235
current_subdoc['url'] = f'{DOCS_SITE}{heading_slug}'
229236
current_subdoc['h1'] = current_h1
237+
current_subdoc['title'] = current_h1
238+
current_subdoc['type'] = 'lvl1'
230239
current_subdoc['object_id'] = custom_slugify(heading_slug)
240+
current_subdoc['hierarchy']['lvl1'] = current_h1
231241
elif line.startswith('## '):
232242
if current_subdoc:
233243
yield from split_large_document(current_subdoc)
@@ -246,7 +256,13 @@ def parse_markdown_content(metadata, content):
246256
'h2': current_h2,
247257
'content': '',
248258
'keywords': metadata.get('keywords', ''),
249-
'objectID': get_object_id(f'{heading_slug}-{current_h2}')
259+
'objectID': get_object_id(f'{heading_slug}-{current_h2}'),
260+
'type': 'lvl2',
261+
'hierarchy': {
262+
'lvl0': metadata.get('title', ''),
263+
'lvl1': current_h1,
264+
'lvl2': current_h2,
265+
}
250266
}
251267
elif line.startswith('### '):
252268
# note we send users to the h2 or h1 even on ###
@@ -267,7 +283,14 @@ def parse_markdown_content(metadata, content):
267283
'h3': current_h3,
268284
'content': '',
269285
'keywords': metadata.get('keywords', ''),
270-
'objectID': get_object_id(f'{heading_slug}-{current_h3}')
286+
'objectID': get_object_id(f'{heading_slug}-{current_h3}'),
287+
'type': 'lvl3',
288+
'hierarchy': {
289+
'lvl0': metadata.get('title', ''),
290+
'lvl1': current_h1,
291+
'lvl2': current_h2,
292+
'lvl3': current_h3,
293+
}
271294
}
272295
elif line.startswith('#### '):
273296
if current_subdoc:
@@ -279,12 +302,20 @@ def parse_markdown_content(metadata, content):
279302
current_subdoc = {
280303
'file_path': metadata.get('file_path', ''),
281304
'slug': f'{heading_slug}',
282-
'url': f'{DOCS_SITE}{heading_slug}#',
305+
'url': f'{DOCS_SITE}{heading_slug}',
283306
'title': current_h4,
284307
'h4': current_h4,
285308
'content': '',
286309
'keywords': metadata.get('keywords', ''),
287-
'objectID': get_object_id(f'{heading_slug}-{current_h4}')
310+
'objectID': get_object_id(f'{heading_slug}-{current_h4}'),
311+
'type': 'lvl4',
312+
'hierarchy': {
313+
'lvl0': metadata.get('title', ''),
314+
'lvl1': current_h1,
315+
'lvl2': current_h2,
316+
'lvl3': current_h3,
317+
'lvl4': current_h4,
318+
}
288319
}
289320
elif current_subdoc:
290321
current_subdoc['content'] += line + '\n'

0 commit comments

Comments
 (0)