Filtering/distinguishing search results by page type in Sphinx search

39 views
Skip to first unread message

Hugo Locurcio

unread,
Oct 23, 2020, 1:32:27 PM10/23/20
to sphinx-users

Hi again,

I'm one of the main contributors to Godot's documentation (https://docs.godotengine.org). Right now, we have our "user manual" and "class reference" pages under the same documentation site. This is convenient for linking across pages, but the search quality suffers as both "user manual" and "class reference" pages will appear in the search results without any way for the user to distinguish them. In fact, it's one of the most common complaints about our documentation system right now.

One of the first solutions we've tried was to use Intersphinx to separate the manual and class reference pages under different documentation sites. Unfortunately, given our documentation pages are also translated in multiple languages, we stumbled upon several limitations with it. This made it not a very reliable solution for our needs: https://github.com/godotengine/godot-docs/pull/3279

At the very least, we'd like to add a way to distinguish between manual and class reference pages in the search result (e.g. with a different icon next to each result). Ideally, we'd prefer to add a button so the user can hide manual or class reference results entirely from search. This can probably be done with some custom JavaScript code, which I can handle.

Can this be achieved using a Sphinx extension, or will I have to create a custom search indexer from scratch to achieve this?

PS: If this helps, all the class reference pages are under the same parent `classes/` folder (represented as "Godot API" in the sidebar)

Thanks in advance for replying,
Hugo Locurcio


Komiya Takeshi

unread,
Oct 25, 2020, 11:57:10 AM10/25/20
to sphinx...@googlegroups.com
Hi,

Even if you made an indexer extension, Sphinx can't separate (or
filter) contents on searching because search-engine (in JS) does not
have such a feature. So you need to replace search-engine also.

>PS: If this helps, all the class reference pages are under the same parent `classes/` folder (represented as "Godot API" in the sidebar)

As a workaround, you can filter it using paths by own custom
search-engine. In this way, you don't need to make an indexer
extension.
Please check searchtools.js.

Thanks,
Takeshi KOMIYA

2020年10月24日(土) 2:32 Hugo Locurcio <hugo.l...@hugo.pro>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/cdf141b0-3a54-4e21-af95-64ba8538c205n%40googlegroups.com.

Daniel Scott

unread,
Nov 25, 2020, 10:28:28 PM11/25/20
to sphinx...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages