Title: REST API for Relevanssi
Author: Sergiy Dzysyak
Published: <strong>12 de setembre de 2018</strong>
Last modified: 14 de maig de 2023

---

Cerca extensions

Aquesta extensió **no s’ha provat en les darreres 3 versions majors del WordPress**.
Segurament no està mantinguda o suportada, i pot tenir problemes de compatibilitat
quan s’usa en versions recents del WordPress.

![](https://ps.w.org/rest-api-for-relevanssi/assets/icon-256x256.png?rev=2370302)

# REST API for Relevanssi

 Per [Sergiy Dzysyak](https://profiles.wordpress.org/dzysyak/)

[Baixa](https://downloads.wordpress.org/plugin/rest-api-for-relevanssi.zip)

 * [Detalls](https://ca.wordpress.org/plugins/rest-api-for-relevanssi/#description)
 * [Ressenyes](https://ca.wordpress.org/plugins/rest-api-for-relevanssi/#reviews)
 *  [Instal·lació](https://ca.wordpress.org/plugins/rest-api-for-relevanssi/#installation)
 * [Desenvolupament](https://ca.wordpress.org/plugins/rest-api-for-relevanssi/#developers)

 [Suport](https://wordpress.org/support/plugin/rest-api-for-relevanssi/)

## Descripció

This plugin provides simple REST API for the popular search [WordPress](https://wordpress.org/)
search engine – [Relevanssi](https://wordpress.org/plugins/relevanssi/).

As far as this plugin provides API for the Relevanssi plugin, it should be installed.

**Key features**

 * Search through posts of a certain type. By default all types.
 * Results in pagination and optional.
 * Sets X-WP-Total header with a total number of records, the same way as the default
   search API does.
 * Sets X-WP-TotalPages header with a total number of pages, the same way as the
   default search API does.
 * Multilingual websites support. Both WPML and Polylang are supported, but not 
   tested well, so let me know if you will find any problems.
 * Taxonomy filters are supported now. Some features may be missed, so feel free
   to report them.
 * Ordering option added. It is also possible to order by meta_key/meta_value/meta_value_num.

**Brief usage examples**

 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=query
 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=query&per_page=5
 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=query&per_page=5&page
   =2

_Define post type:_

 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=query&per_page=5&page
   =2&type=post

_Filter by taxonomy/taxonomies:_

 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=test&tax_query[0][
   taxonomy]=category&tax_query[0][field]=id&tax_query[0][terms]=3
 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=test&tax_query[relation]
   =AND&tax_query[0][taxonomy]=category&tax_query[0][field]=id&tax_query[0][terms]
   =3&tax_query[1][taxonomy]=category&tax_query[1][field]=id&tax_query[1][terms]
   =2

_Exclude category via taxonomies:_

 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=test&tax_query[0][
   taxonomy]=category&tax_query[0][field]=id&tax_query[0][terms]=3&tax_query[0][
   operator]=NOT IN

_For multilingual websites (WPML & Polylang):_

 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=query&lng=en
    - Results in order:
 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=test&type=post&orderby
   =modified&order=DESC
 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=test&type=post&orderby
   =modified&order=ASC
 * https://[your domain]/wp-json/relevanssi/v1/search?keyword=test&type=post&meta_key
   =some_key&orderby=meta_value|meta_value_num&order=ASC

**Demo website**

You can try the plugin on our demo website http://demo.erlycoder.com/demo1/. For
example, you can try the following request:

_Basic:_
 [http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test](http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test)

_Order posts by modification time:_
 [http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test&type=post&orderby=modified&order=DESC](http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test&type=post&orderby=modified&order=DESC)
[http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test&type=post&orderby=modified&order=ASC](http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test&type=post&orderby=modified&order=ASC)

_Filter posts by taxonomy (one single category):_
 [http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test&tax_query[0][taxonomy]=category&tax_query[0][field]=id&tax_query[0][terms]=3](http://demo.erlycoder.com/demo1/wp-json/relevanssi/v1/search?keyword=test&tax_query[0][taxonomy]=category&tax_query[0][field]=id&tax_query[0][terms]=3)

_Filter posts by taxonomy (exclude category):_
 [http://demo.erlycoder.com/demo1/
wp-json/relevanssi/v1/search?keyword=test&tax_query[0][taxonomy]=category&tax_query[
0][field]=id&tax_query[0][terms]=3&tax_query[0][operator]=NOT IN](http://demo.erlycoder.
com/demo1/wp-json/relevanssi/v1/search?keyword=test&tax_query[0][taxonomy]=category&
tax_query[0][field]=id&tax_query[0][terms]=3&tax_query[0][operator]=NOT IN)

## Instal·lació

 1. Ensure that [Relevanssi](https://wordpress.org/plugins/relevanssi/) plugin is installed
 2. Sign in to the admin area of your WordPress website.
 3. Go to the “Plugins” section.
 4. Click “Add new” and search for “REST API for Relevanssi”.
 5. Install the plugin.

Alternative way #1

 1. Ensure that [Relevanssi](https://wordpress.org/plugins/relevanssi/) plugin is installed
 2. Download [REST API for Relevanssi](https://wordpress.org/plugins/rest-api-for-relevanssi/)
    plugin from the WordPress plugin diretcory.
 3. Go to Plugins > Add New > Upload and select the ZIP file you just downloaded. Click
    Install Now, and then Activate.
 4. Activate the plugin through the ‘Plugins’ screen in WordPress
 5. Plugin does not require any further configuration

Alternative way #2

 1. Ensure that [Relevanssi](https://wordpress.org/plugins/relevanssi/) plugin is installed
 2. Download [REST API for Relevanssi](https://wordpress.org/plugins/rest-api-for-relevanssi/)
    plugin from the WordPress plugin diretcory.
 3. Upload the plugin files to the `/wp-content/plugins/rest-api-for-relevanssi` directory,
    or install the plugin through the WordPress plugins screen directly.
 4. Activate the plugin through the ‘Plugins’ screen in WordPress
 5. Plugin does not require any further configuration

## PMF

### Knowledge base

You can find answers and solutions in our [Knowledge base](https://erlycoder.com/knowledgebase_category/relevanssi-rest-api/).

### Can I suggest a feature or report a bug?

Yes, you can submit your request on our [Contact page](https://erlycoder.com/support/).

## Ressenyes

![](https://secure.gravatar.com/avatar/832e2fbad7804f57086715e6612130304ce0e41d288ae5da95464278d3ade45e?
s=60&d=retro&r=g)

### 󠀁[Works well](https://wordpress.org/support/topic/works-well-2767/)󠁿

 [Maxime33](https://profiles.wordpress.org/maxime33/) 29 de maig de 2023

Great plugin, great support!

![](https://secure.gravatar.com/avatar/2eb01c532d88a9e57ae05a2b145a2e5a574a93b0b477c2e11fc37c57d99e47df?
s=60&d=retro&r=g)

### 󠀁[Clean, light and straight to the point](https://wordpress.org/support/topic/clean-light-and-straight-to-the-point/)󠁿

 [Laxus Mcfury](https://profiles.wordpress.org/laxusmcfury/) 16 de abril de 2022
1 resposta

This plugin helped me a lot with my Rest API based live search, i really appreciate
it!

![](https://secure.gravatar.com/avatar/917592606772e84640ecb9ed7b6285f5bea9dfd8e7043068cbdf410fd6c44966?
s=60&d=retro&r=g)

### 󠀁[Nice and simple plugin](https://wordpress.org/support/topic/nice-and-simple-plugin-22/)󠁿

 [mkhaledche](https://profiles.wordpress.org/mkhaledche/) 8 de setembre de 2020

Thank you

 [ Llegiu totes les 3 ressenyes ](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/)

## Col·laboradors i desenvolupadors

«REST API for Relevanssi» és programari de codi obert. La següent gent ha col·laborat
en aquesta extensió.

Col·laboradors

 *   [ Sergiy Dzysyak ](https://profiles.wordpress.org/dzysyak/)

[Traduïu «REST API for Relevanssi» a la vostra llengua.](https://translate.wordpress.org/projects/wp-plugins/rest-api-for-relevanssi)

### Interessats en el desenvolupament?

[Navegueu pel codi](https://plugins.trac.wordpress.org/browser/rest-api-for-relevanssi/),
baixeu-vos el [repositori SVN](https://plugins.svn.wordpress.org/rest-api-for-relevanssi/),
o subscriviu-vos al [registre de desenvolupament](https://plugins.trac.wordpress.org/log/rest-api-for-relevanssi/)
per [fisl de subscripció RSS](https://plugins.trac.wordpress.org/log/rest-api-for-relevanssi/?limit=100&mode=stop_on_copy&format=rss).

## Registre de canvis

#### 1.18

 * Advanced Custom Fields plugin support is improved

#### 1.17

 * Taxonomy index bug fix.

#### 1.16

 * “No content found” error is changed to an empty result. This seems to be the 
   proper response. Feel free to complain via [Contact page](https://erlycoder.com/support/),
   if you do not agree.
 * Error messages are updated for cases where the search keyword is not provided
   or the target language does not exist (for Polylang).
 * WP compatibility update

#### 1.15

 * Error messages fix.

#### 1.14

 * Minor fix in handling post types.
 * WPML & Polylang compatibility fixes.

#### 1.12

 * Minor fix in handling post types.

#### 1.11

 * Fixed issues with type=any parameter.
 * Fixed issues with multitype requests (Example: type=post,page).
 * Default search type is changed to ‘any’. Be careful updating the plugin.

#### 1.10

 * Fixed bug “Call to undefined function is_plugin_active()”.

#### 1.9

 * We decided to remove the strict requirement for the Relevanssi plugin to be installed
   before the API plugin. Instead, API will return an error if Relevanssi is not
   installed.

#### 1.8

 * Added “page” and “per_page” parameters. Old ones “page” and “per_page” are still
   supported, but we strongly recommend to to use new ones.

#### 1.7

 * Maintenance release.

#### 1.6

 * Fixed taxonomy requests.
 * One more example added

#### 1.5

 * Multilingual websites support (WPML & Polylang).
 * Taxonomy filters.
 * Search results ordering.

#### 1.0

 * Release

## Meta

 *  Versió **1.18**
 *  Darrera actualització **fa 3 anys**
 *  Instal·lacions actives **200+**
 *  Versió del WordPress ** 4.6 o posterior **
 *  Provada fins a **6.2.9**
 *  Versió del PHP ** 5.6 o posterior **
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/rest-api-for-relevanssi/)
 * Etiquetes
 * [api](https://ca.wordpress.org/plugins/tags/api/)[Relevanssi](https://ca.wordpress.org/plugins/tags/relevanssi/)
   [rest-api](https://ca.wordpress.org/plugins/tags/rest-api/)[search](https://ca.wordpress.org/plugins/tags/search/)
 *  [Vista avançada](https://ca.wordpress.org/plugins/rest-api-for-relevanssi/advanced/)

## Valoracions

 5 sobre 5 estrelles.

 *  [  3 valoracions de 5 estrelles     ](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/?filter=5)
 *  [  0 valoracions de 4 estrelles     ](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/?filter=4)
 *  [  0 valoracions de 3 estrelles     ](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/?filter=3)
 *  [  0 valoracions de 2 estrelles     ](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/?filter=2)
 *  [  0 valoracions de 1 estrelles     ](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/#new-post)

[Visualitzeu totes les ressenyes](https://wordpress.org/support/plugin/rest-api-for-relevanssi/reviews/)

## Col·laboradors

 *   [ Sergiy Dzysyak ](https://profiles.wordpress.org/dzysyak/)

## Suport

Teniu quelcom a dir? Necessiteu ajuda?

 [Visualitza els fòrums de suport](https://wordpress.org/support/plugin/rest-api-for-relevanssi/)