fix: crop search snippets to 30 words around match

This commit is contained in:
Tianyang 2026-08-01 19:27:07 +08:00
parent 7d4c7eea95
commit 2b287ccb35

View File

@ -34,6 +34,8 @@ class SearchClient:
"attributesToHighlight": ["content"], "attributesToHighlight": ["content"],
"highlightPreTag": "<em>", "highlightPreTag": "<em>",
"highlightPostTag": "</em>", "highlightPostTag": "</em>",
"attributesToCrop": ["content"],
"cropLength": 30,
}) })
results = [] results = []
for hit in response.get("hits", []): for hit in response.get("hits", []):