A lot of WordPress websites are using Relevanssi as a search engine that improves standard built-in searches. A far as websites may be quite complicated, consist of several independent parts REST API allows implementation of such interaction. This plugin provides a simple REST API for the popular search WordPress search engine – Relevanssi.
As far as this plugin provides API for the Relevanssi plugin, it should be installed.
Plugin available for download from WordPress plugin directory or can be installed via standard WordPress plugin installation interface.
- Search through posts of a certain type. By default all types.
- Results pagination and optional.
- Sets X-WP-Total header with a total number of records, the same way as default search API does.
- Sets X-WP-TotalPages header with a total number of pages, the same way as default search API does.
The easiest and fastest way to install the plugin is to do this from the WordPress site plugin management interface. Alternatively one can follow the steps:
- Ensure that the Relevanssi plugin is installed
- Upload the plugin files to the
/wp-content/plugins/relevanssi-rest-api directory, or install the plugin through the WordPress plugins screen directly.
- Activate the plugin through the ‘Plugins’ screen in WordPress
- The plugin does not require any further configuration
- https://[your domain]/wp-json/relevanssi/v1/search?keyword=query
- https://[your domain]/wp-json/relevanssi/v1/search?keyword=query&posts_per_page=5
- https://[your domain]/wp-json/relevanssi/v1/search?keyword=query&posts_per_page=5&paged=2
- https://[your domain]/wp-json/relevanssi/v1/search?keyword=query&posts_per_page=5&paged=2&type=post
You can try the plugin on our demo website http://demo.erlycoder.com/demo1/. For example, you can try the following request: