Wikibase Faceted Search

Easily filter and find your Wikibase data

On this page

External links

Faceted Search for Wikibase

Filter search results by statement values or item type.

Explore your Wikibase data with ease.

Wikibase Faceted Search enhances MediaWiki's search with faceted search capabilities. When searching for items, you can filter the results by the values of their statements via a sidebar.

The sidebar contains facets that show the most common values for each property, together with the number of items that have that value. You can build complex queries by selecting multiple values for the same property or different properties, including range queries, conjunctions (AND) and disjunctions (OR).

Wikibase Faceted Search requires Wikibase and CirrusSearch. See the installation instructions for more details.

Professional Wiki created Wikibase Faceted Search. We are Wikibase developers that provide professional Wikibase software development and Wikibase hosting.

We thank das NFDI-Konsortium MaRDI for funding initial development.

Nutzungsdokumentation

Filtering Search Results

Once Wikibase Faceted Search is installed and configured, the standard search results page will show a tabbed UI. Each tab represents a type of item. For instance, there might be tabs for "Publications", "Authors", and "Events".

By selecting a tab, you limit the search results to items of that type. A sidebar will appear on the right side of the page with facets that allow you to filter the search results further.

The Query String

This documentation is only for advanced users. You do not need to understand what the query string is to use Wikibase Faceted Search.

Advanced users might wish to understand the query string, manipulate it directly, or use it in their own code. The query string is a string that represents the current state of the facets in the sidebar. It is used by the extension to filter search results.

Example query string:

foo haswbfacet:P1=Q123 haswbfacet:P2=a|b|c haswbfacet:P3

This query matches all pages that contain foo, have a statement for P1 with value Q123, have a statement for P2 with value a, b, or c, and have at least one statement for P3.

haswbfacet Keyword Reference

  • haswbfacet:P1 - There is at least one value for property P1
  • -haswbfacet:P1 - There is no value for property P1
  • haswbfacet:P1=A|B|C - There is at least one value for property P1 that is either A, B, or C
  • haswbfacet:P1=A haswbfacet:P1=B - P1 has at least one value that is A and at least one value that is B
  • haswbfacet:P1>2020 - P1 has at least one value that is greater than 2020
  • haswbfacet:P1<2020 haswbfacet:P1>2010 - P1 has at least one value that is between 2010 and 2020

Installation

Requirements

Load and enable

Load the extension using Composer:

COMPOSER=composer.local.json composer require --no-update professional-wiki/wikibase-faceted-search:~1.0

Enable the extension by adding the following to your LocalSettings.php:

wfLoadExtension( 'WikibaseFacetedSearch' );

Update MediaWiki database

Run the MediaWiki update.php script:

php maintenance/run.php update

You can verify the installation by checking your wiki's Special:Version page.

Configure

Because Wikibase Faceted Search only indexes Statements for Properties that are configured to have Facets, you need to finish your initial configuration before building the search index.

If you do not yet have Wikibase Properties, then you first have to create them. You can defer this step to a later time, though you will not get any facets until you have created the properties and specified them in the configuration.

View the configuration documentation.

Build Search Index

Run the following maintenance scripts to build the search index:

php extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse
php extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip

You will need to re-run these whenever you add new properties to the configuration.

Konfiguration

If you install Wikibase Faceted Search without further configuration, your wiki will continue to work as before, but without the faceted search functionality.

How To Configure

Configuration is typically done via the in-wiki configuration page at MediaWiki:WikibaseFacetedSearch. A link to this page can be found in the Wikibase section on the Special:SpecialPages page. The configuration page takes a JSON string that defines the facets that should be shown in the sidebar. The page lists documentation for the configuration options.

You can also change configuration via LocalSettings.php via the wgWikibaseFacetedSearchConfig variable. It takes the same JSON string as the configuration page. Configuration on the configuration page will override the configuration in wgWikibaseFacetedSearchConfig. You can disable the configuration page by setting wgWikibaseFacetedSearchEnableInWikiConfig to false.

Many configuration changes require rebuilding the search index. Not rebuilding the search index after changing the configuration can lead to incorrect search results and incorrect information shown in the facets. It will not break your wiki, and previously configured facets will be unaffected. Thus, it is not absolutely critical to rebuild the search index immediately.

Key Configuration Capabilities

Item Types and Facets

Define what properties should have facets per item type. Example: Publications (P31=Q42) should have facets for Author (P1) and Year of Publication (P2)

Facet and Display Options

Define facet type and display options. For instance, you might wish to use a range facet for numeric properties.

Define UI labels for item types, optionally internationalized. Example: Q42 should be shown as "Publications" in the UI (even if the Wikibase label is "Publication")

Index Wikitext Via Sitelinks

Optionally, specify the Site ID of a Sitelink that points to wikitext pages in your wiki. This will make the wikitext page show up in the results instead of the Wikibase item. It also allows you to combine structured search via the facets with full-text search of whatever is shown on the wikitext page.

This is great for cases where you have "display pages" that show the information from a Wikibase item in a more readable format. For instance, a Author:Q1337 page that shows data from Item:Q1337.

Wikibase Hosting

Check out our tailored Wikibase hosting and Wikibase cloud hosting services.
Both include Wikibase Faceted Search and many other MediaWiki extensions.

Wikibase configuration section on the ProWiki Admin Panel

Weitere MediaWiki-Erweiterungen

View all our extensions

Professionelle MediaWiki-Dienstleistungen

MediaWiki services by the authors of Wikibase Faceted Search

Softwareentwicklung Symbol
Softwareentwicklung

Erzielen Sie hervorragende Ergebnisse mit erfahrenen MediaWiki-Entwicklern, die Erfahrung beim Entwickeln von MediaWiki-Erweiterungen und -Integrationen haben.

Theme-Entwicklung Symbol
Theme-Entwicklung

Lassen Sie Ihr Wiki großartig aussehen! Verwenden Sie ein erprobtes responsives MediaWiki-Theme oder lassen Sie uns ein individuelles MediaWiki-Skin für Sie erstellen.

MediaWiki-Hosting Symbol
MediaWiki-Hosting

Lassen Sie uns Ihr Wiki betreuen und hosten. Wir sind Experten für MediaWiki-Hosting und bieten Cloud-Hosting, dediziertes Hosting und Hosting vor Ort (On-Premises) an.

MediaWiki-Beratung Symbol
MediaWiki-Beratung

Steigern Sie Wert und Qualität Ihres Wikis, indem Sie unsere MediaWiki-Expertise nutzen. Von der Planung bis zur konkreten Implementierung haben wir alles im Griff.

MediaWiki-Migration Symbol
MediaWiki-Migration

Wechseln Sie sorglos zu einem neuen Hosting. Wir migrieren Ihr MediaWiki auf einen neuen Server, oder wir unterstützen Sie beim Umzug von einem anderen Wiki-System zu MediaWiki.

MediaWiki-Upgrades Symbol
MediaWiki-Upgrades

Wir sorgen dafür, dass Ihr MediaWiki auf dem neuesten Stand und geschützt bleibt. Wir bieten Wartung und Aktualisierung für MediaWiki, damit Ihr Wiki störungsfrei läuft.