Page MenuHomePhabricator

[L] Enhance the way the QuickView links searchResult to QuickView article
Closed, ResolvedPublic

Description

In the current version of QuickView the search results and the article that is fetched from the new extension are linked using the "title" attribute that can be found in the searchResults HTML.

image.png (136×1 px, 41 KB)

Until now we have assumed the title shows in that attribute to be the same as the "prefixedText" parameter available in our extension as part of the API searchResult object.

image.png (362×812 px, 61 KB)

Unfortunately, recent development has highlighted that the title is not always correct. The issue occurred when a "statement" was shown as the results of a query. The title attribute of this was not actually its title (that in this case was supposed to be Q3, but a different text "blue: color":

image.png (274×1 px, 91 KB)

AC:

  • Change method of retrieving the result, so that statement works
NOTE: A possible suggestion was to add a new data attribute from the searchVue extension, so that we can easily match it with the available result object

Event Timeline

CBogen renamed this task from Enhance the way the QuickView links searchResult to QuickView article to [L] Enhance the way the QuickView links searchResult to QuickView article.Sep 21 2022, 5:00 PM

Lets chat about this tomorrow! This is specifically being caused due to the installation of Wikibase on a Wiki.

Since we aren't going to initially deploying to a wiki that has Wikibase, it's not a problem we necessarily would need to solve initially.

Agreed that it may not be needed for the current milestone after Seddon comment, but I wanted to share that after a discussion with Matthias we thought to use the QID if possible as the new data attribute. Doing so would actually save the UI from having to do an extra API call (currently we need to do an API call do fetch the QID and then do another for commons and wikidata info).

@SimoneThisDot @Seddon Is using the QID part of this ticket, part of another ticket, or do we need a new ticket for it? I'd like to move this one to the backlog if it's not needed for the first few milestones.

Simone's last comment is already part of this ticket; just a more specific potential implementation of whatever fix we'll come up with here.

We're going to need to do this right now.
Not only are we going to need a more efficient way to fetch the Qid (we're wasting a lot of resources doing a redundant API call, and it's also slowing down how fast the quickview is able to open), but even more importantly: recent development revealed that current way is also not without issues and simply doesn't work for some results.

Note: my last comment was wrong.

  • we're not wasting resources doing a redundant API call - we already have the Qid available from one of the existing calls
    • it's still going to slow down Commons/interwiki results because we can't start doing those requests until we have the ID, but that may not be a big deal and doesn't need to be addressed right away
    • in fact, fetching all Qids ahead of time will also have a (likely minor) impact, so it may even be undesirable
    • if we do want/need to resolve the Qid ahead of time, doing so within wgSpecialSearchTextMatches (in our extension) probably makes more sense then in a data attribute (in core)?
  • we do still need to fix the title thing (I'd suggest to add another data attribute with the actual page title, e.g. data-title="..."), which is a pretty small and important fix, but indeed also not immediately required because of the wikis we roll out to.

TL;DR:

  • this ticket is exclusively about exposing the correct page title; it's an important fix, but can probably be moved to a later milestone (though I'd recommend dealing with it as early as possible - there may be more special cases beyond all of Wikidata; e.g. I wonder if this feature could also conflict: https://en.wikipedia.org/wiki/Wikipedia:Page_name#Changing_the_displayed_title)
  • additional optimizations (like resolving Qid ahead of time) are under consideration; new ticket will be filed to address those, if needed

TL;DR:

  • this ticket is exclusively about exposing the correct page title; it's an important fix, but can probably be moved to a later milestone (though I'd recommend dealing with it as early as possible - there may be more special cases beyond all of Wikidata; e.g. I wonder if this feature could also conflict: https://en.wikipedia.org/wiki/Wikipedia:Page_name#Changing_the_displayed_title)
  • additional optimizations (like resolving Qid ahead of time) are under consideration; new ticket will be filed to address those, if needed

Thanks @matthiasmullie! I'm moving this to Milestone 4 based on your comment -- please let me know if anything changes.

Change 894226 had a related patch set uploaded (by Simone Cuomo; author: Simone Cuomo):

[mediawiki/extensions/SearchVue@master] Enhance the way the QuickView links searchResult to QuickView article

https://gerrit.wikimedia.org/r/894226

Change 894226 merged by jenkins-bot:

[mediawiki/extensions/SearchVue@master] Enhance the way the QuickView links searchResult to QuickView article

https://gerrit.wikimedia.org/r/894226

Etonkovidova subscribed.

Testing notes for checking in wmf.26:

Search for water

enwiki betalabsptwiki wmf.wmf.25enwiki wmf.25
<div class="mw-search-result-heading"><a href="/wiki/Water" title="Water" data-serp-pos="0" data-prefixedtext="Water"><span class="searchmatch">Water</span></a></div><div class="mw-search-result-heading"><a href="/wiki/Avatar:_O_Caminho_da_%C3%81gua" title="Avatar: O Caminho da Água" data-serp-pos="1">Avatar: O Caminho da Água</a> <span class="searchalttitle">(redirect from <a href="/wiki/Avatar:_The_Way_of_Water" class="mw-redirect" title="Avatar: The Way of Water">Avatar: The Way of <span class="searchmatch">Water</span></a>)</span> </div><div class="mw-search-result-heading"><a href="/wiki/Water" title="Water" data-serp-pos="0"><span class="searchmatch">Water</span></a> </div>

Checked pilot wiki wmf.26 - data-prefixedtext is added; no issues are found.