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 raised the priority of this task from to Needs Triage.
Cpiral updated the task description. (Show Details)

Any changes needed in the Translate extension?

Deskana claimed this task.
Deskana subscribed.

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 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 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-ARCHIVED 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 unsubscribed.
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.

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?

MPhamWMF subscribed.

Closing out low/est priority tasks over 6 months old with no activity within last 6 months in order to clean out the backlog of tickets we will not be addressing in the near term. Please feel free to reopen if you think a ticket is important, but bare in mind that given current priorities and resourcing, it is unlikely for the Search team to pick up these tasks for the indefinite future. We hope that the requested changes have either been addressed by or made irrelevant by work the team has done or is doing -- e.g. upgrading Elasticsearch to a newer version will solve various ES-related problems -- or will be subsumed by future work in a more generalized way.

RhinosF1 removed a project: Discovery-Search.
RhinosF1 subscribed.

Re-opening tasks and removing from team workboard per IRC feedback given yesterday and discussion with MPham.