From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type User interface, Search
DescriptionTemplate:Extension#description Provides a Semantic MediaWiki search with Apache Solr
Author(s)Template:Extension#username Simon Bachenberg, Sascha Schüller
Latest versionTemplate:Extension#version 0.8.2 (2013-05-27)
MediaWikiTemplate:Extension#mediawiki 1.16+
PHPTemplate:Extension#php 5
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license Apache License 2.0
ExampleTemplate:Extension#example - Fieldbased Search

- Mediawiki Search with Solr

  • $wgSolrUrl
  • $wgSolrFields
  • $wgSolrShowRelated
  • $wgSolrDebug
  • $wgSolrTalker
  • $wgSolrOmitNS
  • $wgSolrTemplate

Translate the SolrStore extension if it is available at translatewiki.net

Check usage and version matrix.

The SolrStore extension is a search provider for Semantic MediaWiki. You can search your semantic properties with the power of a fulltext search engine (lucene), by defining custom search forms.


The following software is required:


  • At first you need to install Solr.
  • After that copy the Solr Configuration files from /SolrStore/solr-example/core0 to one of your Solr cores and restart your Tomcat.
  • Download and place the file(s) in a directory called SolrStore in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/SolrStore/SolrStore.php";
    $smwgDefaultStore = "SolrConnectorStore";
    #url to your solr
    $wgSolrUrl = 'http://localhost:8080/solr/sofis';
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters[edit]

//FieldSets for Field-based Searching
//The Last 3 are Optional, we use the “Additional Query string” for searching in just one Category. 
//You can switch between AND and OR Logic. If you want to switch this for all your querys, 
//than you have to change <solrQueryParser defaultOperator="AND"/> in your schema.xml.
//You can’t sort dynamic Fields with this, because of a restriction from Solr. But there is a workaround for that. 
//You can define a CopyFields in your Schema.xml and Copy an dynamic Field in this static Field (dynamic Fields are created by runtime like a attributes. 
//Static Fields are all Fields defined in your Schema.xml like pagename). 

//new SolrSearchFieldSet('<Name of the SearchFieldSet>',
//                       '<List of Fields/Attributes>', 
//                       '<Labels for your Fields>', 
//                       '<Additional querystring added to the end of your Search query>', 
//                       '<AND / OR >', 
//                       '<Sorting Options>'
//                       )

$wgSolrFields = array(
    new SolrSearchFieldSet('Projekte', 'titleCombi;Institution_s; Personen; Id_s', 'Titel(stichworte); Institutionen; Personen; SOFIS-Nr. (Erfassungsnr.)', ' AND category:Projekte', 'AND'),
    new SolrSearchFieldSet('Institutionen', 'institutionCombi; Inst-ID;ort;Land', 'Institution(sstichworte); SOFIS-Institutions-Nr.;Ort;Land', ' AND category:Institution', 'AND', 'pagetitle asc')

//This array includes all namespaces that you don’t want to be indexed. 
$wgSolrOmitNS = array(102,106);

//SolrStore will print the url he uses for search querys if its turned on
//e.g. http://sofis.gesis.org:8080/solr/sofis/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on
$wgSolrDebug = false;

//This is to disable the “Did you mean ….” Feature. I recommend you to turn it off if you use $wgSolrFields 
//with extra query parameters like  “AND category:Projects”, because it will always recommend you the page “Projects”.
$wgSolrShowRelated = false;

Template System[edit]

  • If you prefer to use other template for example: "FIS Template"
  • add to LocalSettings.php
# define Template
$wgSolrTemplate = "_FIS";

create template[edit]

  • Conditions to use:
  1. create the file in: ./extensions/SolrStore/templates
  2. make a copy of the existing SolrSearchTemplate_Standart.php
  3. rename the file to: SolrSearchTemplate_NEWNAME.php
  4. rename the class to: SolrSearchTemplate_NEWNAME
  5. add to LocalSettings.php:
# define Template
$wgSolrTemplate = "_NEWNAME";

For faster indexing use "maintenance/runJobs.php" and run some Jobs.

Known bugs / features[edit]

  • Some queries still end in exceptions, like an open "(" without a closing ")"
  • SolrStore has some problems with namespaces. If you delete a talk page, Solr also removes the corresponding regular page from his index. This means you have to open and save the regular page again, for Solr to index the page again. Do not worry this does not mean that your page gets deleted, it just will not show up in your search for a short time.


If you want to try our search visit: