Extension:SolrStore

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
SolrStore

Release status: beta

SMWsolr-small.png
Implementation User interface, Search
Description Provies a Semantic MediaWiki search with Apache Solr
Author(s) Simon Bachenberg, Sascha Schüller
Latest version 0.8.1 (2013-05-17)
MediaWiki 1.16+
PHP 5
Database changes No
License Apache 2.0
Download
README
Example - Fieldbased Search

- Mediawiki Search with Solr

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

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

Check usage and version matrix; code metrics

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

Requirements[edit | edit source]

Having Semantic MediaWiki installed is a precondition for the SolrStore extension. The code will not work without it.

The following software is required:

Download[edit | edit source]

Since we migrated to Git, we can not update our extension! This means you have to download our extension from SourceForge if you want the newest Version:

Download: https://sourceforge.net/projects/smwsolrstore/files/?source=navbar

We have a new definition for the SearchFields in Version 0.8: http://sourceforge.net/p/smwsolrstore/home/Overview/


git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SolrStore.git

Installation[edit | edit source]

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.

To install this extension, add the following to LocalSettings.php:

include_once("$IP/extensions/SolrStore/SolrStore.php");
$smwgDefaultStore = "SolrConnectorStore";
 
#url to your solr
$wgSolrUrl = 'http://localhost:8080/solr/sofis';

Configuration parameters[edit | edit source]

//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 | edit source]

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

create template[edit | edit source]

  • 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.

Version[edit | edit source]

  • Update 2012-09-26
    • Now SolrStore indexes all pages and the fullwiki text of a page
    • New parameters $wgSolrOmitNS, $wgSolrShowRelated, $wgSolrDebug
    • Many bugs fixed

Known bugs / features[edit | edit source]

  • 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.

Demo[edit | edit source]

If you want to try our search visit: