Page MenuHomePhabricator

Allow TemplateWizard to search template descriptions
Open, Needs TriagePublicFeature

Description

At current, it seems I can only search for a template if I already know that template's name. That is not a very intuitive way to search. Search sort of implies that I can find more than one result or have fuzzy matching or turn up results (more than one and more than by the exact template name).

TemplateWizard Search should help users find templates without already knowing their full names. It should ideally have fuzzy matching, auto-complete suggestions, and be able to search for a template based on a template's TemplateData description. It's not helpful to new users to have a search box that can't be searched in without already knowing what terms to enter. Especially for oddly named templates on wikis where there are many many templates already in use, necessitating the need to have some less-than-desirable template names. Fuzzy search matching for TemplateWizard search would make the most sense, and allowing users to search based on template data description. (E.g., typing "Cate" should offer up, "Category link" and other relevant templates that start with the same name or have the word "category" in the TemplateData description.

This would help to ensure that users can more easily find/search and compare templates by their descriptions so they know what template to use for what. That's what I thought the default behavior would be for inserting a template via Template Wizard, but I have just created some new templates, then rebuilt my search indexes with 'rebuildall.php' and TemplateWizard can't find templates based on their TemplateData descriptions. I must be doing something wrong, or this is a bug, or a very necessary feature that wasn't thought of?

For example, If I have a template "Category Link" I can't search for it by entering "Category", no predicted results come up, I have to know and type the whole name before that template will be offered up. This isn't searching as much as it is inputting a template name. In wikitext mode, inserting a template via the insert template button offers up a search icon and "search for a template" text seems to suggest that I should be able to search, but I actually can't search at all--very misleading. I type "Category" and nothing comes up. I type "Category Link" and nothing comes up. I type "Category_Link" and my category link template comes up as it apparently can't recognize spaces as underscores. For with names like "ctg" not being able to search via template description is completely useless to a user, who would probably enter "category" and would never think to enter ctg, despite the word "category" being in the template data description. I'd change all of my template names but it really wouldn't help without true search functionality. User's can even enter a first letter to get a list of templates beginning with that letter.

So, my conclusion is that a user has to know all the template names and purposes before coming to insert a template. At least in VE it doesn't offer a "search" icon (magifying glass) and doesn't have "search for a template" text in the field to mislead users. But having an insert a template button is pretty useless for users that don't have hundreds of template names memorized.

This is just never going to be the case, or am I missing something? Is there some maintenance script that needs to be run every time a template with template data is added? My job queue is empty, it also can't find newly added templates with the TemplateWizard wikitext "search". There is nothing on the documentation page that suggests how to get new templates with valid template data recognized. I can get the template data via the API, so it is valid and working... There has to be something I'm missing or doing wrong. I'm going to run any maintenance script I can think of that might be relevant.

Product Version
MediaWiki 1.33.0 (We are waiting for 1.35 to drop for upgrade)
PHP 7.3.15 (cgi-fcgi)
MySQL 5.7.28-log
ICU 57.1

Template wizard 0.1.0 (096f34e) 20:17, 24 March 2019

Related Objects

StatusSubtypeAssignedTask
OpenFeatureNone
ResolvedWMDE-Fisch
ResolvedWMDE-Fisch
ResolvedLena_WMDE
ResolvedLena_WMDE
Resolvedthiemowmde
DeclinedNone
Resolvedthiemowmde
Resolvedthiemowmde
Resolvedthiemowmde
ResolvedLena_WMDE
ResolvedLena_WMDE
DeclinedNone
Resolvedlilients_WMDE
DeclinedAndrew-WMDE
ResolvedWMDE-Fisch
ResolvedAndrew-WMDE
ResolvedBUG REPORTawight
ResolvedNone
ResolvedAndrew-WMDE
ResolvedNone

Event Timeline

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

Is there something else required to get this working that maybe isn't listed in the documentation? Like a search extension not included with MediaWiki?

Edit: So I found confirmation that this is how it is supposed to work:
https://www.mediawiki.org/wiki/Help:Extension:TemplateWizard#How_do_I_find_a_template?

A null edit to the template page itself did nothing to help the template data show up per the TemplateData documentation so it is not that (and job queue still empty, no errors in the console, /api.php?action=templatedata&titles=Template:Templatename&format=jsonfm returns correct TemplateData):
Help:TemplateData#Limitations and feedback

I ran:
update.php
rebuildall.php/rebuildtextindex.php
refreshLinks.php
runJobs.php

Still no search results when attempting to insert a template in Edit Source or VE. I just get the useless search dialog with"Learn more about TemplateWizard" notice at the bottom.

TemplateWizard searches by prefix (e.g.), and it does sound like it'd be nice if it could also search template descriptions and maybe other parts of template names. That search capability would be need to be added first to TemplateData though.

But are you also saying that you can't get your install of TemplateWizard to give you any search results at all? It should be able to search by prefix — try a prefixsearch via Special:ApiSandbox just to see if that's giving you the results you expect. TemplateWizard isn't doing anything special in this regard.

Having at least partial search be usable has been requested here https://phabricator.wikimedia.org/T203193 since right now you can't even use TemplateData search to do a partial search via template name. I'm not exactly sure if I need to create a separate task for the ask you mention or if adding it to the existing one is sufficient (I'm not a programmer).

No, I cannot get TemplateData to provide any search results at all using insert template button in Edit Source mode. Nothing is ever returned, though template data is working correctly and showing in VE when a template is edited. And Insert > Template in VE will only insert a template if the exact template name is entered (there is no search facility apparently available and no partial search suggestions or search suggestions at all).

Also, I'm not sure how to do what you ask, I don't see an option for prefix search here:
https://the.dragon-mania-legends.wiki/Special:ApiSandbox

If I copy the URL you provided from the API portion beyond just receive:

{"batchcomplete":"","pages":{}}

Template example with template data:
https://the.dragon-mania-legends.wiki/api.php?action=templatedata&titles=Template:Ei&format=jsonfm

And a sandbox to try it in:
https://the.dragon-mania-legends.wiki/User:Cryscryb2/Sandbox3

It looks like there's something odd going on with the normal prefix search function on that wiki: https://the.dragon-mania-legends.wiki/Special:ApiSandbox#action=query&format=json&list=prefixsearch&pssearch=Ei&psnamespace=* doesn't return Template:Ei (or seemingly, any templates at all).

Yeah and it's a fresh install with pages imported... Because we first had an issue with TemplateData not being recognized. After exporting all pages to xml and re-importing into a clean DB that issue was solved, so we assumed a DB issue. So here I go again, with another fresh install, no extensions and no pages imported this time, to see if I can replicate again.

Edit: Turned out to be an incompatibility with the TitleKey Extension.

Aklapper renamed this task from Please allow TemplateWizard to search template descriptions to Allow TemplateWizard to search template descriptions.Jan 17 2022, 6:46 PM
Aklapper changed the subtype of this task from "Task" to "Feature Request".