是否可以增加 Sphinx 搜索页面的深度?

Is it possible to increase the depth of the Sphinx search page?

上图是Sphinx文档生成器的搜索功能。

正如您在图片中看到的,搜索页面未显示 DefinitionsOrders 下的 'objects'。是否有使搜索结果更深一层的设置?

我假设 objects 您指的是包含搜索命中 (example) 的文章文本片段。我们称它为 搜索摘要

1) Sphinx 搜索returns 的摘要文本的长度是硬编码的,如您在source code 中所见(函数:makeSearchSummary, l.457ff) . 它的长度通常为 240 个字符(加上两倍 ...= 246)。 要更改此设置,您可以 create your own Sphinx theme 使用自定义搜索功能。

2) 您可能看不到任何搜索摘要,因为您是在本地文件系统上打开搜索。在这种情况下,搜索会尝试动态请求搜索命中的文件。一些浏览器(即 Google Chrome)将这些请求视为非法 cross origin requests 并阻止它们。在 Firefox 或 Internet Explorer 中打开搜索或尝试使用(本地)静态文件服务器提供文件 - 例如 sphinx-autobuild。现在,应该会显示搜索摘要。

3)有know issues with the Sphinx search summary. And there is a Sphinx extension trying to fix this免责声明:我写了扩展)。