6

I'm trying to search for a keyword within a specific category on Wikimedia Commons. For example, like to search for "red flowers" within "Category:Flowers" so that I can categorize the images accordingly.

If this can't be done on Wikimedia Commons, is it possible to do this on other MediaWiki websites?

2

This is possible on Wikimedia Commons.

Can I specify categories when searching?

[...] To do this, just add +incategory:"CategoryName" to the search string. [...]

For example, if you wanted to look for the purple things in the "Flowers" category, you'd use this:

purple +incategory:"Flowers"

Be warned that if you're trying this on a default or fresh install of a MediaWiki site, it may not work since it's a Lucene search specific function that needs setting up.

  • can you provide a link to doc on how Lucene search syntax extensions? The linked page and their linked doc pages (which they admit are sparse and old) do not mention category or incategory search at all. – djb Apr 17 '13 at 20:11
  • Find it in the first link in this answer, which is en.wikipedia.org/wiki/Wikipedia%3aFAQ/… @djb – Eight Days of Malaise Apr 25 '13 at 4:03
  • Beware: the incategory keyword produces only a subset of the articles in a category. It works only for articles that directly include a category tag ([[Category:Whatever]]). It fails for any article that transcludes the category tag. This unfortunate behavior occurs because Lucene is not designed to notice transcluded category tags. – DanB Dec 8 '14 at 19:37
1

As far as I know, MediaWiki's standard installation does its search on the page syntax. So you may simply combine your key word with the category definition in parantheses:

keyword "[[Category:keycategory]]"
  • Not correct: the default MediaWiki search engine (using MySQL) searches only text, not wikitext symbols. – DanB Dec 8 '14 at 19:39
  • This works for me! purple +incategory:"Flowers" didn't work though, indicating that the wiki I'm searching probably doesn't have lucene set up. – nnyby Dec 12 '14 at 16:51
0

If neither of those works for you, and the category name is relatively unique on the site, you can try Google: site:wiki.example.com "name of category" <keywords>.

For example, to find Beck lyrics, you can do site:lyrics.wikia.com "songs by beck" <keywords>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.