Extension:Multi-Category Search

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
Multi-Category Search
Release status: unmaintained
MultiCatSearch.png
Implementation Search, Special page , Data extraction
Description Extension introduces a new special page Special:MultiCategorySearch, that allows users to find pages that are included in several specified categories at once.
Author(s) Iaroslav Vassiliev (CodeMonktalk)
Latest version 1.69 (2016-12-13)
MediaWiki MediaWiki 1.8 - 1.31?             To make this work in versions up to 1.34, see "Unofficial fix" below.
Database changes No
License GNU General Public License 2.0
Download
Example 1 (English Version)
2 (German Version)
3 (Russian version)

  • $inCategoriesNumber
  • $exCategoriesNumber
  • $useDropdownLists
  • $insertEditTools
  • $paramsPassMethod
Check usage and version matrix.

The Multi-Category Search extension allows users to find pages that are included in several specified categories at once (pages that intersect Intersection.jpg multiple categories). By default a user can specify up to 5 categories to intersect, and optionally up to 3 categories to be completely excluded from search. Upon many requests, drop-down lists were introduced in version 1.3, and since version 1.5 it's now possible to fill drop-down lists automatically with subcategories of some parent category. Extension was first released on January 23rd, 2008‎.

Purpose and usage[edit]

The extension is very important, if you need, for example, to find all articles about American comedy movies released in 1990 on your cinema-related wiki. In this case you just need to go to [[Special:MultiCategorySearch]] special page, specify three categories there: "USA films", "Comedy films" and "1990 films", and click on search button. That's it - you get the list of movies.

Installation[edit]

  • Download and place the file(s) in a directory called MultiCategorySearch in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/MultiCategorySearch/MultiCategorySearch.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration[edit]

General configuration settings are set in five variables in the beginning of MultiCategorySearch_body.php file.

Maximum number of categories that user can select:

var $inCategoriesNumber = 5;

Maximum number of categories that user can exclude from search:

var $exCategoriesNumber = 3;

When set to true, drop-down lists with predefined categories are shown on the search form. Categories for drop-down lists must be predefined in showDropdownLists() function in the end of MultiCategorySearch_body.php file.

var $useDropdownLists = false;

When set to true, script inserts MediaWiki:Edittools at the bottom of the search form. Edittools allow a user to insert special characters in an easy way. Remember, that EditTools require Extension:CharInsert to be installed and AJAX to be enabled (global $wgUseAjax variable must be set to true in LocalSettings.php file).

var $insertEditTools = false;

Default HTTP method of passing parameters. Change it to 'get' if required.

var $paramsPassMethod = 'post';

Transclusion[edit]

By transclusion the multi-category search results could be dynamically shown on some other page. Transclusion format is:

{{Special:MultiCategorySearch/include=Category 1/include=Category 2/exclude=Category 3}}

Version history[edit]

  • 1.69 — An update to suit MediaWiki 1.27 and 1.28.
  • 1.68 — An update to suit MediaWiki 1.26.
  • 1.67 — An update to suit MediaWiki 1.24.
  • 1.66 — Minor bugfix.
  • 1.65 — An update to suit MediaWiki 1.21.
  • 1.64 — Multiple transclusions on one page have been enabled.
  • 1.63 — An update to suit MediaWiki 1.19. Drop-down lists configuration system has been simplified.
  • 1.62 — An update to suit MediaWiki 1.18.
  • 1.61 — Minor bugfix.
  • 1.6 — Localized messages caching system has been updated.
  • 1.5 — An option to fill drop-down lists automatically with subcategories of some parent category has been added. Minor bugfix.
  • 1.4 — A patch by William Moore has been applied, allowing Special:MultiCategorySearch page to be transcluded.
  • 1.38 — Minor bugfix.
  • 1.37 — Minor changes.
  • 1.36 — Minor bugfixes.
  • 1.35 — Minor internal improvements.
  • 1.34 — Minor internal improvements.
  • 1.33 — Listing of articles, which are not included in specified categories, is now available even if no category was selected to search for.
  • 1.31 — Minor bugfix.
  • 1.3 — Optional drop-down list selection was added.
  • 1.21 — Edittools file has been added; database tables prefixes recognition was enabled.
  • 1.01 — Minor bugfix.
  • 1.0

Localization[edit]

  • Spanish messages by José Zarco
  • German messages by Astrid Kuhr
  • French messages by Thierry Giroux Veilleux
  • Dutch messages by Nanda Jansen
  • Russian messages by Iaroslav Vassiliev
  • Turkish messages by Helmut Oberdiek
  • Hebrew messages by Avner Pinchover
  • Polish messages by Dawid Kamola
  • Italian messages by Cristian Filagrossi
  • Japanese messages by Kouichi Nishizawa
  • Czech messages by Vojtěch Zlámal
  • Swedish messages by Tomas Kindahl

Feedback[edit]

If you would like to report a bug or request a feature, you can do it on discussion page or on SourceForge. If you could help with translation, please, send me a letter to codedriller@gmail.com. By the way, if you need advanced bot functionality for your wiki project, take a look at free DotNetWikiBot Framework, that I maintain.

Unofficial fix[edit]

MultiCategorySearch, if used as downloaded, crashes in WikiMedia 1.31 and 1.34. The changes below are unofficial because the extension's author does not respond. With these changes, MultiCategorySearch is known to work well on one site. It is not known if it works in all use cases.

To make this extension work in WikiMedia 1.31[edit]

comment out in file MultiCategorySearch_body.php line 144

wfProfileIn( 'MultiCategorySearch::showResults' );

and line 311

wfProfileOut( 'MultiCategorySearch::showResults' );

To make it work in WikiMedia 1.34[edit]

change line 146 from

$dbr = wfGetDB( DB_SLAVE );

to

$dbr = wfGetDB( DB_REPLICA );

change line 343 from

$wgOut->addWikiText( $msgComment );

to

$wgOut->addWikiTextAsInterface( $msgComment );

change line 406 from

$wgOut->addWikiText( $contents );

to

$wgOut->addWikiTextAsInterface( $contents );

change line 415 from

$dbr = wfGetDB( DB_SLAVE );

to

$dbr = wfGetDB( DB_REPLICA );

The line numbers above relate to the original source code as downloaded.

See also[edit]