Community Wishlist Survey 2019/Search/Linksearch overhaul

Linksearch overhaul

  • Problem:
    • Protocol-specific: Currently, I have to do two separate link searches to find links to cover both secure and non-secure links e.g. Special:Linksearch/* and Special:Linksearch/https://*
    • I can't filter by namespace - unless using the API, and even then it is clunky as the filtering is done in PHP and not MariaDB.
    • Perform more complicated searches (e.g. blogspot.*)
    • Result set size limitations.
  • Who would benefit: Anyone who uses this special page.
  • Proposed solution:
    • Eliminate the technical debt in the externallinks table to make queries faster.
    • Separate the domain and protocol out as distinct database columns. Make these queryable.
    • Add a proper namespace filter.
    • Return results for all protocols when no protocol is specified.
    • Make all of these improvements available through the API.
  • Proposer: MER-C (talk) 12:02, 30 October 2018 (UTC)


Some notes:

  • Filtering by namespace would require creating and populating a column in the database and adding appropriate indexes. gerrit:163470 might be relevant there.
  • Separating the protocol from the rest of the URL would similarly require database changes. It still might not be possible to request "http OR https", just "http", "https", or "any protocol".
  • More complicated searches on the domain/path are rather unlikely, as efficient SQL search of text columns is generally limited to prefixes (or depends on methods that are heavily database-dependent; note MediaWiki actively supports three database engines and sort-of supports two more).
  • There's also the fact that searching for links to internationalized domain names (IDNs) means you have to try both the encoded and IDN version. That'll be fixed by gerrit:322729, if it eventually gets merged.
  • There's also the fact that searching for links using IPs doesn't work very well. That too will be fixed by gerrit:322729.
  • If by "eliminate the technical debt [...] to make queries faster" you're referring to the fact that it gets slower as you page through the results and there's therefore a limit on the special page, that should be fixed by gerrit:322729 too. Although that patch doesn't actually remove the special page's limit.

Anomie (talk) 14:59, 30 October 2018 (UTC)

  • @MER-C: Just a ping to let you know about the comments above. Possibly they could help you clarify your proposal before the voting begins. (With 200+ ideas, clear proposals make everyone's life easier!) Quiddity (WMF) (talk) 01:30, 8 November 2018 (UTC)
  • There is a really powerful workaround for linksearch and that's just to use Special:Search insource. It handles arbitrary URL schemes, can be filtered by namespace, has wildcards if you know a little regex, and has no result size limit. I might even advocate we eliminate the technical debt by removing the Special:LinkSearch page and advocate Special:Search instead. --Izno (talk) 23:57, 8 November 2018 (UTC)

As an alternative to Anomie's suggestions, this can also be done in the elasticsearch cluster. We already index the external_links for every page on every wiki, they are just not analyzed in a way that is useful for this type of search. It is certainly possible to run analysis on the external links to create sub-fields like domain name, url pieces, etc, and search against those. Additionally we could probably expose regex on external_links if if was a common enough request. EBernhardson (WMF) (talk) 15:33, 9 November 2018 (UTC)

I note that Special:LinkSearch is a core MediaWiki feature, while use of ElasticSearch is optional and requires an extension. We should keep in mind usability by non-Wikimedia wikis. Anomie (talk) 19:04, 9 November 2018 (UTC)
  • Adding a namespace filter to linksearch has been on my top five list ever since it was briefly implemented then withdrawn. It is massively useful. You can do it from AWB, I have on occasion resorted to using AWB to process a list then bringing the list back to enWP to fix. PLEASE do this! JzG (talk) 00:31, 16 November 2018 (UTC)


  •   Support MER-C (talk) 19:01, 16 November 2018 (UTC)
  •   Support ديفيد عادل وهبة خليل 2 (talk) 09:03, 17 November 2018 (UTC)
  •   Support Libcub (talk) 11:26, 17 November 2018 (UTC)
  •   Support Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 13:22, 17 November 2018 (UTC)
  •   Support Winged Blades of Godric (talk) 16:53, 17 November 2018 (UTC)
  •   Support Zabia (talk) 10:07, 18 November 2018 (UTC)
  •   Support Liuxinyu970226 (talk) 12:31, 18 November 2018 (UTC)
  •   Support Dvorapa (talk) 19:01, 18 November 2018 (UTC)
  •   Support Strong support. Problems with current minimal interface start when variants with/without "www" or http/s. Namespace filters also good, for example to focus on main space, not drafts or discussions. Wildcards - extra :) --Wargo (talk) 21:21, 18 November 2018 (UTC)
  •   Support Wumbolo (talk) 17:27, 19 November 2018 (UTC)
  •   Support Sadads (talk) 18:53, 19 November 2018 (UTC)
  •   Support Needed to track spam and other dubious external links. Johnuniq (talk) 08:33, 20 November 2018 (UTC)
  •   Support Vulphere 13:17, 20 November 2018 (UTC)
  •   Support Another hell yeah — regards, Revi 16:30, 20 November 2018 (UTC)
  •   Support Novak Watchmen (talk) 13:53, 21 November 2018 (UTC)
  •   Support Krinkle (talk) 03:10, 22 November 2018 (UTC)
  •   Support Luenséin (talk) 09:29, 23 November 2018 (UTC)
  •   Support Matěj Suchánek (talk) 09:35, 24 November 2018 (UTC)
  •   Support Hmxhmx 11:13, 24 November 2018 (UTC)
  •   Support Nikkimaria (talk) 22:32, 25 November 2018 (UTC)
  •   Support — AfroThundr (u · t · c) 02:47, 26 November 2018 (UTC)
  •   Support Horst Emscher (talk) 11:05, 26 November 2018 (UTC)
  •   Support YFdyh000 (talk) 17:41, 27 November 2018 (UTC)
  •   Support Ciao • Bestoernesto 01:13, 28 November 2018 (UTC)