Page MenuHomePhabricator

Autosuggest templates in advanced parameters form
Closed, ResolvedPublic5 Estimated Story Points

Description

As a user,
I want some help to pick templates which searching,
so that when I search, I get valid results

Acceptance Criteria:

  • The UI Widget where I select templates shows a list of available templates when it has focus and i started to type the first letter.
  • The UI Widget shows only the templates that match the text that is already typed.
  • When a template from the list is selected, it becomes a "pill" inside the UI widget.

Background:
This needs to be implemented as a custom widget. Since MenuTagMultiselectWidget expects a fixed number of options and loading ALL the templates into memory would cost too much memory and bandwidth, it's better to subclass TagMultiselectWidget and use the LookupElement mixin to provide the menu.

The API endoint is opensearch. An example query for the German Wikipedia for all templates beginning with "Burg" looks like this:
https://de.wikipedia.org/w/api.php?action=opensearch&format=json&formatversion=2&search=Burg&namespace=10&limit=100&suggest=true

Related Objects

Event Timeline

Lea_WMDE renamed this task from Search prototype: Autosuggest templates to Autosuggest templates in advanced parameters form.May 30 2017, 4:45 PM
gabriel-wmde set the point value for this task to 5.Jul 12 2017, 12:24 PM

@daniel Some questions:

  1. is the suggested API endpoint the right one for the "completionSearch" you mentioned?
  1. CompletionSuggester, states that it does not support querying namespaces with the completion algorithm, other than the main one? This matches the results I get with the API. When I use namespace 10 (templates), I only have a prefix search, for namspeace 0 (Main) I get full title search. Any idea on how to activate the algorithm for different namespaces?

I had uploaded it as Draft because it's a WIP, not knowing that I have to add you as reviewers so you can see it. Now I've added you.

Addressed that the search apparently is only triggered once.

As it was discussed for the namespaces... was there a decision on how we deal with suggestions already present as pill? Should suggestions be shown for them? (/cc @gabriel-wmde @Lea_WMDE @Charlie_WMDE)

Working on a secondary PR that prevents update events emitted from store when no actual change happened - helps us avoid boilerplate (loop-preventing) code in all subscribers.

@gabriel-wmde Please take a look at https://gerrit.wikimedia.org/r/#/c/373035/, see if you think this could be worthwhile (maybe with further additions, hence WIP).

As it was discussed for the namespaces... was there a decision on how we deal with suggestions already present as pill? Should suggestions be shown for them? (/cc @gabriel-wmde @Lea_WMDE @Charlie_WMDE)

Hey @Pablo-WMDE, sorry for the late response. I was on holiday and it seems like this issue hasn't been addressed in the meantime.

We do NOT want to have things in pills suggested to the user in the dropdown. If the pill gets removed, it reappears in the dropdown again.

Or is the question whether we should prioritize suggestions based on existing pills? If this is possible and there's data for that then I'd definitely recommend doing that. But i assume this would be whole different issue.

Moved back to doing since the patch is WIP nd presumably action is needed from our (devs) side. @gabriel-wmde you might be able to finish this one quickly?

gabriel-wmde claimed this task.

It was already implemented as described, thanks @Pablo-WMDE ! I've rolled out the latest version on the test wiki so you can see for yourself. Try looking for "Erster Test" and "Zweiter Test" as template names.