Skip to content
Back to top
View this page
Edit this page

# MediaWiki Engine

The MediaWiki engine is a generic engine to query Wikimedia wikis by the MediaWiki Action API. For a query action all Wikimedia wikis have endpoints that follow this pattern:

    https://{base_url}/w/api.php?action=query&list=search&format=json

Note

In its actual state, this engine is implemented to parse JSON result (format=json) from a search query (list=search). If you need other `action` and `list` types ask SearXNG developers to extend the implementation according to your needs.

## Configuration

Request:

- `base_url`

- `search_type`

- `srenablerewrites`

- `srsort`

- `srprop`

## Implementations

searx.engines.mediawiki.search_type: str = 'nearmatch'

  Which type of search to perform. One of the following values: `nearmatch`, `text` or `title`.

  See `srwhat` argument in list=search documentation.

searx.engines.mediawiki.srenablerewrites: bool = True

  Enable internal query rewriting (Type: boolean). Some search backends can rewrite the query into another which is thought to provide better results, for instance by correcting spelling errors.

  See `srenablerewrites` argument in list=search documentation.

searx.engines.mediawiki.srsort: str = 'relevance'

  Set the sort order of returned results. One of the following values: `create_timestamp_asc`, `create_timestamp_desc`, `incoming_links_asc`, `incoming_links_desc`, `just_match`, `last_edit_asc`, `last_edit_desc`, `none`, `random`, `relevance`, `user_random`.

  See `srenablerewrites` argument in list=search documentation.

searx.engines.mediawiki.srprop: str = 'sectiontitle|snippet|timestamp|categorysnippet'

  Which properties to return.

  See `srprop` argument in list=search documentation.

searx.engines.mediawiki.base_url: str = 'https://{language}.wikipedia.org/'

  Base URL of the Wikimedia wiki.

  `{language}`:

    ISO 639-1 language code (en, de, fr ..) of the search language.

searx.engines.mediawiki.api_path: str = 'w/api.php'

  The path the PHP api is listening on.

  The default path should work fine usually.

searx.engines.mediawiki.timestamp_format = '%Y-%m-%dT%H:%M:%SZ'

  The longhand version of MediaWiki time strings.