Page MenuHomePhabricator

Prioritize TemplateData description when indexing/searching
Closed, DeclinedPublic

Description

A MediaWiki template that is described via TemplateData in a machine-readable way also provides a short description for the template (see https://www.mediawiki.org/wiki/Extension:TemplateData#TemplateData_object). This description is part of a JSON blob in the wikitext, and rendered as part of a table on the template page (example: https://en.wikipedia.org/wiki/Template:Cite_journal#TemplateData). But this table is typically way down on the page.

Is it possible to prioritize this description when indexing template pages, like it is a subheading or lead paragraph? The HTML of the element in question is currently <p class="mw-templatedata-doc-desc">…</p>, but can be changed if needed.

In which codebase or configuration could such a change be done?

This request is a result of the investigation done in T272457.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Not going to do this. While possible, it's high effort with not much to win.

For reference: Declining this was partly based on conversations we had with the Discovery-Search team. While it is technically possible to change the CirrusSearch index to give TemplateData descriptions a much higher priority – or introduce a new index that does this – it's very high effort for a secondary feature like this. It's also rather unlikely that doing this will significantly improve the quality of the search results. Cirrus already indexes all text it finds in the template's documentation. Words that are highly relevant to understand what a template is about probably appear multiple times on the page – not only in the TemplateData description – and will be ranked high anyway.

We are also told that the existing Cirrus index is a delicate piece of art meant to please a very general audience. It's very unlikely that it will be changed for a special use case like this. If we really want it, it will most probably be a separate index, which WMDE would need to maintain. This is just not sustainable.