jayvdb added a comment. In https://phabricator.wikimedia.org/T119316#1865867, @Anomie wrote:
> In https://phabricator.wikimedia.org/T119316#1865521, @jayvdb wrote: > > > `SearchPageGenerator` uses API search > > <https://www.mediawiki.org/wiki/API:Search>. > > > > I see File pages from Commons appearing when I search for "file:...", but > > not without file: > > > > https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=file:Campos%20de%20Cari%C3%B1ena,%20Espa%C3%B1a > > > > https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=Campos%20de%20Cari%C3%B1ena,%20Espa%C3%B1a > > > > Is "file:..." required to trigger this behaviour, or can it happen other > > ways? > > > Add `gsrnamespace=6`, or a list of namespaces including 6. Thanks. Is that the only case where non-local pages are included in the results (by default)? I checked https://phabricator.wikimedia.org/tag/globaluserpage/ , and they dont appear in search results. I'm interested in determining the scope and likely impact of this bug, and look for workarounds. The bug is already being resolved by implementing `ExistingPageBot` as a base class of the scripts (this hasnt been done for `replace.py` yet.) If this bug only occurs with File pages, and the pywikibot user explicitly requested file pages, it is quite an obscure bug, and the bug title and description need to be made more precise. >> IMO they should never have been included in the API results by default; the >> caller should have to explicitly request that the API search module includes >> pages which do not (and never have) existed on the wiki. > > action=search is intended to work equivalently to Special:Search. Of course it is desirable that all special:search results can be fetched by the API, but I hope and pray the API has a little more thought put into it, and strives to higher goals of being an API instead of a UI. An existing example where the API and UI differ: changes in the $wgNamespacesToBeSearchedDefault <https://www.mediawiki.org/wiki/Manual:$wgNamespacesToBeSearchedDefault> are not reflected in the API. Search namespaces do not default to $wgNamespacesToBeSearchedDefault . e.g. English Wikisource includes 102, 106 & 114 in the default namespaces in the UI, but that doesnt occur in the API https://en.wikisource.org/w/api.php?action=help&modules=query+search Are you sure that the API search can not have a parameter to control whether these non-local pages are included? It can be enabled by default, like the `redirects` default was flipped in v1.23. It is very odd that Search API parameters `interwiki` and `redirect` exist, but these non-local files can not be excluded...? TASK DETAIL https://phabricator.wikimedia.org/T119316 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: jayvdb Cc: Anomie, jayvdb, Aklapper, StudiesWorld, binbot, pywikibot-bugs-list, Tgr, Legoktm _______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
