Last modified: 2013-07-25 17:02:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 13438 - Allow Special:MIMESearch to work under miser mode
Allow Special:MIMESearch to work under miser mode
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
All All
: Low enhancement (vote)
: ---
Assigned To: Bawolff (Brian Wolff)
: schema-change
Depends on:
  Show dependency treegraph
Reported: 2008-03-19 22:07 UTC by Victor Vasiliev
Modified: 2013-07-25 17:02 UTC (History)
9 users (show)

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

Proposed patch (2.59 KB, patch)
2008-03-19 22:07 UTC, Victor Vasiliev
Updated patch, use add_index() (3.78 KB, patch)
2008-06-26 20:42 UTC, Chad H.
With fixes (1.50 KB, patch)
2008-07-07 16:28 UTC, Chad H.

Description Victor Vasiliev 2008-03-19 22:07:03 UTC
Created attachment 4731 [details]
Proposed patch

Special:MIMESearch will work efficiently on Wikimedia if we will add indexing by (img_major_mime, img_minor_mime).
Comment 1 Brion Vibber 2008-03-19 22:09:00 UTC
You should be able to use the generic index updater function instead of writing a custom one here.
Comment 2 Chad H. 2008-06-26 20:42:38 UTC
Created attachment 5021 [details]
Updated patch, use add_index()

Updated the previous patch to use add_index() per Brion's comments.
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-06-26 20:48:51 UTC
You have unrelated changes to User.php there.  Also, I suggest you commit the reformatting of the img_sha1 lines separately and recreate the patch, because they just distract from the patch's actual content.
Comment 4 Chad H. 2008-07-07 16:28:41 UTC
Created attachment 5057 [details]
With fixes

Updated previous patch. Removed unrelated changes.
Comment 5 Brion Vibber 2008-07-07 17:25:52 UTC
This schema tweak will do the job of making the query faster, but IMHO it's not a super great system to begin with. If we have to make a schema change, it might be good to consider the basic issues first:

* There's no secondary sorting or filtering, which means it's going to be of very limited utility unless you're searching for a particularly exotic type.

The results list will appear in semi-random order, paging through results will be very slow.

A secondary index on name would at least allow for basic ordering and index-based paging.
Comment 6 Brion Vibber 2008-12-28 21:46:23 UTC
This index *might* be useful sometimes for bulk statistics, but the core case (a sensible way of searching based on mime type) would probably be better served by making some image metadata (including mime type) available to the fulltext search index.

If appropriately integrated, you could then do a search for soemthing like:

image:moon landing mime:application/ogg

and get a sensible result of files with a text match for "moon landing" and a MIME type matching application/ogg.
Comment 7 Brett Zamir 2011-04-11 06:08:02 UTC
I'm building a tool (at ) to allow Ajax browsing of Mediawiki articles, currently for the purpose of performing XQueries against XML stored on wikis, and hopefully for optional local IndexedDB storage as well. It is very unsafe to make these queries at the moment (working on that), but especially after whenever I may be able to get that resolved, I'd want to be able to point people by default to logical locations for a starting point for browsing XML documents at any given Mediawiki wiki.

Currently, when the user chooses a Mediawiki wiki, I'm supplying its root category by default, but it would be great if the API could filter out only those categories belonging to a particular MIME type (or at least if the MIME search worked) so I could avoid my users seeing non-XML pages (though I could parse a page fully into XHTML and expose that once I can figure out how to do that properly through the API). And it would be nice to do all this if this would not require users to manually add categories for these file format types.

(Incidentally, would be great to have the ability to directly edit XML files such as SVG (and TEI--my main interest) with the benefit of diffs and all, rather than needing to treat them as images on the one hand, or to put them directly within articles without the choice of whether to disable wiki markup.)
Comment 8 Roan Kattouw 2011-05-14 16:35:35 UTC
The attached patch will probably still apply (almost; the part would have to be done manually I guess), but the index should probably be on (major_mime, minor_mime name) to facilitate paging. Also, Special:MIMESearch's queries should be looked at to see what kind of index we'd actually need, and maybe tweaked to be more reasonable (like, use proper paging instead of OFFSET). I'd also like to change it to no longer be a QueryPage, because parameterized QueryPages don't really make sense.

And of course we should also expose this functionality in the API :)
Comment 9 Sumana Harihareswara 2011-11-10 06:56:39 UTC
+reviewed since folks have given Chad code review
Comment 10 Bawolff (Brian Wolff) 2013-06-07 17:41:25 UTC
I did another attempt at this. With a little bit more complexity on the php side, I believe it is possible to do this efficiently without adding any more indicies.

I agree that searching for mimes can be done in much better way, but this sort of simple use still has its uses. Thus if we can make it work without messing with the indicies, I think we should. (That said, we should still attempt to do something better for searching by mime type in the mysterious future. Fixing this doesn't mean we can't have both)

Please see Gerrit change #67468 (Where are thou gerrit notification bot?)
Comment 11 Gerrit Notification Bot 2013-07-25 03:58:32 UTC
Change 67468 merged by jenkins-bot:
Make Special:MIMESearch a non-expensive special page.
Comment 12 Umherirrender 2013-07-25 17:02:06 UTC
successfully merged

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