Search in the documentation returns irrelevant results since 3.27.x

Hi, some time ago the CMake Docs site got search broken.

For example, when I search for the install command, the search returns lots of irrelevant stuff:

The search returns add_library, lots of Release Notes. And the item I actually would like to be the first one in the search results - is drowned somewhere deep on the page surrounded with lots of garbage.

The search behavior was different approximately six month ago, when I was using search the last time.

Nowdays I have to use google instead of the internal docs search to find what I need.

It would be nice if the docs search got rolled back to what it was before the last updates (approximately as it was six month ago), as now it seems useless.

AFAIK the search was never better.
It’s a simple Javascript based search generated by Sphinx. Which just searches for words without prioritization.
As the search is contained in each version, you can simply check the search of an older one if you get different results.

In the past, I guess, you simply searched for a word that gives better results than the quite widely used “install”.

Thank you for your answer, you were extremely helpful with your per-version search idea.

Now I got the exact issue. The search behavior changed between 3.26 and 3.27.1.

For example, trying to search for CMAKE_TOOLCHAIN_FILE in 3.26 gives absolutely relevant results.

The same search in 3.27.1 returns garbage.

Please see the image attached:

Thanks. One difference is that the version of Sphinx used was updated. The 3.26 documentation is generated with Sphinx 5.0.2, and the 3.27.1 documentation is generated with Sphinx 5.3.0.

I reproduced the problem with documentation generated by a Sphinx built from source locally. The problem bisects to Sphinx PR 10819, first released in Sphinx 5.2.0.

I also discovered that adding a trailing space to the search term works around the problem.

I opened CMake Issue 25175 for this.

1 Like

CMake 3.27.2 includes a workaround for generating its documentation for cmake.org. It removes the problematic code from the html documentation generated by Sphinx.