Last modified: 2013-08-11 04:50:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24773, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22773 - [PrefixSearch] Namespace name part of prefix search query should not override given namespace id(s)
[PrefixSearch] Namespace name part of prefix search query should not override...
Status: NEW
Product: MediaWiki
Classification: Unclassified
Search (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: Future release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 27411
  Show dependency treegraph
 
Reported: 2010-03-08 19:04 UTC by Umherirrender
Modified: 2013-08-11 04:50 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Umherirrender 2010-03-08 19:04:49 UTC
When type into the search field (on de.wp) 'Kategorie:Vorlage:I' (in en: Category:Template:I) I get suggestion for 'Vorlage:I' (in en: Template:I). The Category-namespace is ignored. The example category is named 'Kategorie:Vorlage:Infobox'.
Comment 1 Umherirrender 2010-03-26 21:37:34 UTC
This works on the special page prefixindex [[:de:Special:PrefixIndex/Kategorie:Vorlage:I]], but fails on the openSearchXML-Api with the namespace:
action=opensearch&format=xml&namespace=14&search=Vorlage:I
Comment 2 Umherirrender 2010-10-29 09:55:23 UTC
Changing to MWSearch, because it looks like a problem there or in LuceneSearch.

MWSearch implements Hook "PrefixSearchBackend" and return false, so override the default from MediaWiki, which work.
Comment 3 Krinkle 2011-08-11 10:57:16 UTC
Renaming and moving bug.

Steps to reproduce:
* Get a wiki with pages like "Category:Template:Foo" (namespace=14, title="Template:Foo")
* Query open search namespace=14&prefix=Template:F
* ApiOpenSearch detects "Template:" as a prefix and searches in that namespace, ignoring 14.

Source code to confirm:
* ApiOpenSearch calls PrefixSearch [1]
* PrefixSearch creates a Title object from search query, and calls getNamespace(). If it does not return NS_MAIN, it uses the namespace of that title object, thus overriding and ignoring the given namespace id to search in (line 29 of PrefixSearch.php)

See also bug 30323.


--
Krinkle

[1] http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/api/ApiOpenSearch.php?revision=92400&view=markup#l45
[2] http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/PrefixSearch.php?revision=86255&view=markup#l24
Comment 4 Krinkle 2011-08-14 13:57:00 UTC
Just brought this up on IRC. Seems it's not possible due to performance to query multiple namespaces in the same query because the index is on page_namespace,page_title. So that would mean that searching for "Foo" in namespace 0, 5 and 10 would likely only give results for the namespace 0 since it's ordered by namespace and then by page_title.

For it to make sense we'd have to do multiple queries (one for each of the wanted namespaces). Then in PHP combine them and sort them by page_title and then by namespacename (not namespace-id).

So prefix "Foo", with namespaces=0|2|4 would give:
['Foo', 'Abbawiki:Foo', 'User:Foobar']
Comment 5 Mark A. Hershberger 2012-01-23 15:46:25 UTC
switch to milestone, remove release tracking dep
Comment 6 Mark A. Hershberger 2012-09-28 19:01:56 UTC
no work done and release is coming

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links