Page MenuHomePhabricator

Add the possibility to change the sorting order in SearchPageGenerator in pywikibot
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where):
Add the possibility to change the sorting order, like in Special:Search on most wikis, in SearchPageGenerator, described on this page on Mediawiki.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
When using SearchPageGenerator to edit a few articles (like 5-10 %) from a large search (in my example about 200K results), restarting the bot means going through all the articles already checked, which increased the time to process every results and the number of requests to the API. Caching the results can also solve this issue, but it's not always possible/desirable.

Benefits (why should this be implemented?):

  • it will increase the usefulness of pywikibot (not needed to use another implementation instead)
  • it can reduce the number of requests to the API (i.e. more work done in the same time)
  • it can reduce the complexity of some code trying to work around

Event Timeline

Xqt changed the task status from Open to In Progress.Feb 23 2025, 4:30 PM
Xqt claimed this task.
Xqt triaged this task as Medium priority.

Change #1122110 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Add sort parameter to SearchPageGenerator and site.search()

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

@Mr_Tortue: Are you able to review the patch given above?

Dans T386594#10574882, @Xqt a écrit :

@Mr_Tortue: Are you able to review the patch given above?

I wasn't able to review the patch directly in Gerrit since I'm not very familiar with that tool. Instead, I downloaded the change and tested it locally. The functionality works as expected, however it seems you didn't add tests. Do you plan to add some or is it not really relevant ?

Thank you fro review. Sure, some tests should be added. Working on it.

Change #1122110 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Add sort parameter to SearchPageGenerator and site.search()

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

Xqt changed the task status from In Progress to Open.Mar 1 2025, 5:15 PM

Tests are required by T85310 already, so closing this.