Extension:WikiSearch

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
WikiSearch
Release status: stableCategory:Stable extensions
Implementation API Category:API extensions, Parser function Category:Parser function extensions, SearchCategory:Search extensions
Description Faceted search for MediaWiki
Author(s) Xxmarijnwtalk (Wikibase Solutions) and others
Latest version 8.0.1 (2024-07-25)
MediaWiki 1.35+Category:Extensions with manual MediaWiki version
PHP 7.4+
Database changes Yes
Composer open-csp/wiki-searchCategory:Extensions supporting Composer
Tables search_facets
search_parameters
search_properties
License GNU General Public License 2.0 or later
Download Category:Extensions in GitHub version control
  • $wgWikiSearchElasticStoreIndex
  • $wgWikiSearchDefaultResultLimit
  • $wgWikiSearchHighlightFragmentSize
  • $wgWikiSearchHighlightNumberOfFragments
  • $wgWikiSearchElasticSearchHosts
  • $wgWikiSearchAPIRequiredRights
  • $wgWikiSearchSearchFieldOverride
  • $wgWikiSearchMaxChainedQuerySize
  • $wgWikiSearchEnableDebugMode
  • wikisearch-execute-api
  • wikisearch-edit-data-standard
Category:All extensions

The WikiSearch (previously WSSearch) extension implements a faceted search API for Semantic MediaWiki using ElasticSearch.

Usage

  • See /api on how to use the WikiSearch API.
  • See /usage on how to use the #WikiSearchConfig parser function.
  • See /advanced on how to extend WikiSearch and how to use more advanced features such as property chains.
  • When using WikiSearchFront, one does not need to know the details of the API. To set up a search engine, use the parser functions #WikiSearchConfig and #WikiSearchFrontend on a page. WikiSearchFront is the de facto standard frontend extension for WikiSearch.

The #WikiSearchConfig parser function is used to set several configuration variables that cannot be passed to the API for security reasons. It sets the search conditions for that page and the list of facet properties. The base query parameter can be used to limit the set of pages that are included in the search.

{{#WikiSearchConfig:
  |base query=<optional: SMW query>
  |<facet property>
}}

The facet property values should correspond to existing Semantic MediaWiki properties on your wiki. For instance,

{{#WikiSearchConfig:
  |base query=[[Class::Documentation]]
  |Version
  |Tag
  |Space
}}
Only one call to #WikiSearchConfig is allowed per page. Multiple calls will result in unexpected behavior.

Configuration

This extension provides the following optional configuration variables:

FlagDefaultDescription
$wgWikiSearchElasticStoreIndex"smw-data-" . strtolower( wfWikiID() ))Sets the name of the ElasticStore index to use.
$wgWikiSearchDefaultResultLimit10Sets the number of results to return when no explicit limit is given.
$wgWikiSearchHighlightFragmentSize250Sets the maximum number of characters in the highlight fragment.
$wgWikiSearchHighlightNumberOfFragments1Sets the maximum number of highlight fragments to return per result.
$wgWikiSearchElasticSearchHosts["localhost:9200"]Sets the list of ElasticSearch hosts to use.
$wgWikiSearchAPIRequiredRights["read", "wssearch-execute-api"]Sets the list of rights required to query the WikiSearch API.
$wgWikiSearchSearchFieldOverrideSets the search page to redirect to when using Special:Search. The user is redirected to the specified wiki article with the query parameter search_query specified through the search page if it is available. Does not change the behaviour of the search snippets shown when using the inline search field.
$wgWikiSearchMaxChainedQuerySize1000Sets the maximum number of results to retrieve for a chained property query. Setting this to an extreme value may cause ElasticSearch to run out of memory when performing a large chained query.
$wgWikiSearchEnableDebugModefalseEnables debug mode.

Installation

It is recommended to use this extension in combination with WikiSearchFront.
This extension requires the Semantic MediaWiki extension with the ElasticSearch back-end.
  • Download and place the file(s) in a directory called WikiSearch in your extensions/ folder.
  • Only when installing from Git, run Composer to install PHP dependencies, by issuing composer install --no-dev in the extension directory. (See T173141 for potential complications.)Category:Extensions requiring Composer with git
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'WikiSearch' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

See also

Category:Search
Category:API extensions Category:All extensions Category:ArticleDeleteComplete extensions Category:BeforePageDisplay extensions Category:Extensions in GitHub version control Category:Extensions requiring Composer with git Category:Extensions supporting Composer Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:LoadExtensionSchemaUpdates extensions Category:PageContentSaveComplete extensions Category:ParserFirstCallInit extensions Category:Parser function extensions Category:Search Category:Search extensions Category:Stable extensions