Page MenuHomePhabricator

CirrusSearch hastemplate can't find Translatable template
Open, LowPublic

Description

The Translate extension, comes with {{Translatable template}}, but a translated template is no longer searchable with CirrusSearch hastemplate search parameter.

Hastemplate can find template usage where the target is a secondary template, and this ability should also be able to find where the target template is passed as a parameter. Currently hastemplate doesn't recognize the parameter list as "a place for template names", as it does in template code, where it the target template as a secondary.

The only workaround is a set of case-insensitive regex searches, for all possible combination of aliases, and even after all that work, it still sacrifices the visibility of secondary template.

For example, these two queries should have the same count, but hastemplate is way off:

  • [hastemplate: ApiEx](//mediawiki.org/wiki/Special:Search/all:hastemplate: ApiEx)
  • [insource:/TNT *\| *ApiEx/i insource: "tnt apiex"](//mediawiki.org/w/index.php?search=all:insource:/Tnt *\| *ApiEx/i+insource:+"tnt+apiex"&title=Special:Search&go=Go)

For a target template with two aliases, six queries are required, and even then no secondary template-usage is found:

  • [hastemplate:Documentation](//mediawiki.org/wiki/Special:Search/all:hastemplate: Documentation)
  • insource:/TNT *\| *Documentation/i insource: "tnt documentation"
  • insource:/TNT *\| *Doc/i insource: "tnt doc"
  • insource:/TNT *\| *Template doc/i insource: "tnt template doc"
  • [insource:/Translatable template *\| *Documentation/i insource: "Translatable template documentation"](//mediawiki.org/w/index.php?search=all:insource:/Translatable template+*\|+*Documentation/i+insource:+"Translatable template+documentation"&title=Special:Search&go=Go)
  • [insource:/Translatable template *\| *Doc/i insource: "Translatable template doc"](//mediawiki.org/w/index.php?search=all:insource:/Translatable template+*\|+*Doc/i+insource:+"Translatable template+doc"&title=Special:Search&go=Go)
  • [insource:/Translatable template *\| *Template doc/i insource: "Translatable template template doc"](//mediawiki.org/w/index.php?search=all:insource:/Translatable template+*\|+*Template+doc/i+insource:+"Translatable template+template+doc"&title=Special:Search&go=Go)

Event Timeline

Cpiral created this task.Feb 5 2016, 1:11 AM
Cpiral raised the priority of this task from to Needs Triage.
Cpiral updated the task description. (Show Details)
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptFeb 5 2016, 1:11 AM
Cpiral set Security to None.
Cpiral removed subscribers: ContentTranslation, CirrusSearch.
Restricted Application added a project: Discovery. · View Herald TranscriptFeb 5 2016, 1:19 AM
Dereckson updated the task description. (Show Details)Feb 5 2016, 2:02 AM
Cpiral updated the task description. (Show Details)Feb 5 2016, 5:39 AM

Any changes needed in the Translate extension?

Deskana closed this task as Resolved.Mar 23 2016, 2:52 PM
Deskana claimed this task.
Deskana added a subscriber: Deskana.

The example query given in the task's description now appears to work, so it seems that this was fixed at some point (possibly in T88247). Marking as resolved.

Cpiral reopened this task as Open.Mar 23 2016, 11:08 PM
Deskana closed this task as Resolved.Mar 23 2016, 11:25 PM

@Cpiral Are you still having issues with this? Can you document those issues here? The example query you listed in the description now appears to correctly return results, so I'm unsure what the issue is. In particular, I'd appreciate:

  1. Reproduction steps
  2. Expected output
  3. Actual output

Thanks very much! I'm re-closing this task in the mean time, as it's generally confusing to reopen tasks without stating why it's been reopened. Feel free to reopen once you've provided the above information.

The hastemplate query does work, but it does not find what the regexp query reports, which is actual template usage in a site with Translate.

The two queries should square.

Deskana reopened this task as Open.Mar 23 2016, 11:29 PM
Deskana removed Deskana as the assignee of this task.

The hastemplate query does work, but it does not find what the regexp query reports, which is actual template usage in a site with Translate.
The two queries should square.

Thanks. I'll reopen this and repurpose the task for this.

Deskana renamed this task from Hastemplate cannot find a translatable template to Hastemplate sometimes under-reports the number of templates that a page is included on.Mar 23 2016, 11:30 PM
Deskana triaged this task as Low priority.
Deskana updated the task description. (Show Details)
Deskana moved this task from Needs triage to Search on the Discovery board.

Any changes needed in the Translate extension?

Given the above clarification by @Cpiral, I doubt that any changes are needed in the Translate extension for this issue.

Cpiral renamed this task from Hastemplate sometimes under-reports the number of templates that a page is included on to Hastemplate cannot find a translatable template.Mar 23 2016, 11:31 PM
Cpiral closed this task as Resolved.
Cpiral reopened this task as Open.
Cpiral assigned this task to Deskana.
Cpiral raised the priority of this task from Low to Needs Triage.
Cpiral updated the task description. (Show Details)

There is no mystery here; translatable templates are transcluded via their subpages, so you'll find templatelinks for the subpages. https://www.mediawiki.org/wiki/Special:Search/all:hastemplate:ApiEx/en gives 300+ results vs. 20 for the base page.

Nemo_bis renamed this task from Hastemplate cannot find a translatable template to Hastemplate for a title doesn't match templatelinks to all subpages thereof.Mar 24 2016, 9:27 PM
Nemo_bis removed a subscriber: Nemo_bis.
Cpiral renamed this task from Hastemplate for a title doesn't match templatelinks to all subpages thereof to CirrusSearch hastemplate can't find Translatable template.Mar 24 2016, 10:23 PM
Cpiral triaged this task as Low priority.
Cpiral updated the task description. (Show Details)

Per recent title changes, yes, a little text processing of title listings shows 28 of the 53 regex hits are found by hastemplate, like Template:Speedy: hastemplate: documentation prefix:template:speedy

Did hastemplate actually find 28 instances (Documentation as a TNT parameter)?
And if so, there is yet another issue: only two Speedy of many are found.

Deskana removed Deskana as the assignee of this task.Aug 31 2018, 12:37 PM
Restricted Application added a project: Discovery-Search. · View Herald TranscriptAug 31 2018, 12:37 PM

At a high level, this from the opening seems to capture the request:

Hastemplate can find template usage where the target is a secondary template, and this ability should also be able to find where the target template is passed as a parameter. Currently hastemplate doesn't recognize the parameter list as "a place for template names", as it does in template code, where it the target template as a secondary.

Basically search does not control the list of templates that belong to a page, rather the wikitext parser emits something called a ParserOutput, and we index everything the parser says is a template of the page. It sounds to me that this request is then for the wikitext parser to consider these templates to be templates used as part of the page?