{"id":91090,"date":"2018-09-12T22:02:51","date_gmt":"2018-09-12T22:02:51","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/rest-api-for-relevanssi\/"},"modified":"2023-05-14T22:03:47","modified_gmt":"2023-05-14T22:03:47","slug":"rest-api-for-relevanssi","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/rest-api-for-relevanssi\/","author":16377121,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.18","stable_tag":"trunk","tested":"6.2.9","requires":"4.6","requires_php":"5.6","requires_plugins":null,"header_name":"REST API for Relevanssi","header_author":"Sergiy Dzysyak","header_description":"Adds REST API Endpoint for Relevanssi queries","assets_banners_color":"","last_updated":"2023-05-14 22:03:47","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"http:\/\/erlycoder.com","rating":5,"author_block_rating":0,"active_installs":200,"downloads":6740,"num_ratings":3,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":3},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":2370302,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":2370302,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1556,25244,23853,944],"plugin_category":[],"plugin_contributors":[161788],"plugin_business_model":[],"class_list":["post-91090","plugin","type-plugin","status-publish","hentry","plugin_tags-api","plugin_tags-relevanssi","plugin_tags-rest-api","plugin_tags-search","plugin_contributors-dzysyak","plugin_committers-dzysyak"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/rest-api-for-relevanssi\/assets\/icon-128x128.png?rev=2370302","icon_2x":"https:\/\/ps.w.org\/rest-api-for-relevanssi\/assets\/icon-256x256.png?rev=2370302","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>This plugin provides simple REST API for the popular search <a href=\"http:\/\/wordpress.org\/\" title=\"Your favorite blogging software\">WordPress<\/a> search engine - <a href=\"https:\/\/wordpress.org\/plugins\/relevanssi\/\" title=\"A Better Search\">Relevanssi<\/a>.<\/p>\n\n<p>As far as this plugin provides API for the Relevanssi plugin, it should be installed.<\/p>\n\n<p><strong>Key features<\/strong><\/p>\n\n<ul>\n<li>Search through posts of a certain type. By default all types.<\/li>\n<li>Results in pagination and optional.<\/li>\n<li>Sets X-WP-Total header with a total number of records, the same way as the default search API does.<\/li>\n<li>Sets X-WP-TotalPages header with a total number of pages, the same way as the default search API does.<\/li>\n<li>Multilingual websites support. Both WPML and Polylang are supported, but not tested well, so let me know if you will find any problems.<\/li>\n<li>Taxonomy filters are supported now. Some features may be missed, so feel free to report them.<\/li>\n<li>Ordering option added. It is also possible to order by meta_key\/meta_value\/meta_value_num. <\/li>\n<\/ul>\n\n<p><strong>Brief usage examples<\/strong><\/p>\n\n<ul>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=query<\/li>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=query&amp;per_page=5<\/li>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=query&amp;per_page=5&amp;page=2<\/li>\n<\/ul>\n\n<p><em>Define post type:<\/em><\/p>\n\n<ul>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=query&amp;per_page=5&amp;page=2&amp;type=post<\/li>\n<\/ul>\n\n<p><em>Filter by taxonomy\/taxonomies:<\/em><\/p>\n\n<ul>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;tax_query[0][taxonomy]=category&amp;tax_query[0][field]=id&amp;tax_query[0][terms]=3<\/li>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;tax_query[relation]=AND&amp;tax_query[0][taxonomy]=category&amp;tax_query[0][field]=id&amp;tax_query[0][terms]=3&amp;tax_query[1][taxonomy]=category&amp;tax_query[1][field]=id&amp;tax_query[1][terms]=2<\/li>\n<\/ul>\n\n<p><em>Exclude category via taxonomies:<\/em><\/p>\n\n<ul>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;tax_query[0][taxonomy]=category&amp;tax_query[0][field]=id&amp;tax_query[0][terms]=3&amp;tax_query[0][operator]=NOT IN<\/li>\n<\/ul>\n\n<p><em>For multilingual websites (WPML &amp; Polylang):<\/em><\/p>\n\n<ul>\n<li><p>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=query&amp;lng=en<\/p>\n\n<ul>\n<li>Results in order:<\/li>\n<\/ul><\/li>\n<li><p>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;type=post&amp;orderby=modified&amp;order=DESC<\/p><\/li>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;type=post&amp;orderby=modified&amp;order=ASC<\/li>\n<li>https:\/\/[your domain]\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;type=post&amp;meta_key=some_key&amp;orderby=meta_value|meta_value_num&amp;order=ASC<\/li>\n<\/ul>\n\n<p><strong>Demo website<\/strong><\/p>\n\n<p>You can try the plugin on our demo website http:\/\/demo.erlycoder.com\/demo1\/. For example, you can try the following request:<\/p>\n\n<p><em>Basic:<\/em>\n<a href=\"http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test\">http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test<\/a><\/p>\n\n<p><em>Order posts by modification time:<\/em>\n<a href=\"http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;type=post&amp;orderby=modified&amp;order=DESC\">http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;type=post&amp;orderby=modified&amp;order=DESC<\/a>\n<a href=\"http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;type=post&amp;orderby=modified&amp;order=ASC\">http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;type=post&amp;orderby=modified&amp;order=ASC<\/a><\/p>\n\n<p><em>Filter posts by taxonomy (one single category):<\/em>\n<a href=\"http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;tax_query[0][taxonomy]=category&amp;tax_query[0][field]=id&amp;tax_query[0][terms]=3\">http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;tax_query[0][taxonomy]=category&amp;tax_query[0][field]=id&amp;tax_query[0][terms]=3<\/a><\/p>\n\n<p><em>Filter posts by taxonomy (exclude category):<\/em>\n[http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;tax_query[0][taxonomy]=category&amp;tax_query[0][field]=id&amp;tax_query[0][terms]=3&amp;tax_query[0][operator]=NOT IN](http:\/\/demo.erlycoder.com\/demo1\/wp-json\/relevanssi\/v1\/search?keyword=test&amp;tax_query[0][taxonomy]=category&amp;tax_query[0][field]=id&amp;tax_query[0][terms]=3&amp;tax_query[0][operator]=NOT IN)<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Ensure that <a href=\"https:\/\/wordpress.org\/plugins\/relevanssi\/\" title=\"A Better Search\">Relevanssi<\/a> plugin is installed<\/li>\n<li>Sign in to the admin area of your WordPress website.<\/li>\n<li>Go to the \u201cPlugins\u201d section.<\/li>\n<li>Click \u201cAdd new\u201d and search for \u201cREST API for Relevanssi\u201d.<\/li>\n<li>Install the plugin.<\/li>\n<\/ol>\n\n<p>Alternative way #1<\/p>\n\n<ol>\n<li>Ensure that <a href=\"https:\/\/wordpress.org\/plugins\/relevanssi\/\" title=\"A Better Search\">Relevanssi<\/a> plugin is installed<\/li>\n<li>Download <a href=\"https:\/\/wordpress.org\/plugins\/rest-api-for-relevanssi\/\">REST API for Relevanssi<\/a> plugin from the WordPress plugin diretcory.<\/li>\n<li>Go to Plugins &gt; Add New &gt; Upload and select the ZIP file you just downloaded. Click Install Now, and then Activate.<\/li>\n<li>Activate the plugin through the 'Plugins' screen in WordPress<\/li>\n<li>Plugin does not require any further configuration<\/li>\n<\/ol>\n\n<p>Alternative way #2<\/p>\n\n<ol>\n<li>Ensure that <a href=\"https:\/\/wordpress.org\/plugins\/relevanssi\/\" title=\"A Better Search\">Relevanssi<\/a> plugin is installed<\/li>\n<li>Download <a href=\"https:\/\/wordpress.org\/plugins\/rest-api-for-relevanssi\/\">REST API for Relevanssi<\/a> plugin from the WordPress plugin diretcory.<\/li>\n<li>Upload the plugin files to the <code>\/wp-content\/plugins\/rest-api-for-relevanssi<\/code> directory, or install the plugin through the WordPress plugins screen directly.<\/li>\n<li>Activate the plugin through the 'Plugins' screen in WordPress<\/li>\n<li>Plugin does not require any further configuration<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id='knowledge%20base'><h3>Knowledge base<\/h3><\/dt>\n<dd><p>You can find answers and solutions in our <a href=\"https:\/\/erlycoder.com\/knowledgebase_category\/relevanssi-rest-api\/\" title=\"REST API for Relevanssi\">Knowledge base<\/a>.<\/p><\/dd>\n<dt id='can%20i%20suggest%20a%20feature%20or%20report%20a%20bug%3F'><h3>Can I suggest a feature or report a bug?<\/h3><\/dt>\n<dd><p>Yes, you can submit your request on our <a href=\"https:\/\/erlycoder.com\/support\/\" title=\"Report a bug or suggest a feature\">Contact page<\/a>.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.18<\/h4>\n\n<ul>\n<li>Advanced Custom Fields plugin support is improved<\/li>\n<\/ul>\n\n<h4>1.17<\/h4>\n\n<ul>\n<li>Taxonomy index bug fix.<\/li>\n<\/ul>\n\n<h4>1.16<\/h4>\n\n<ul>\n<li>\"No content found\" error is changed to an empty result. This seems to be the proper response. Feel free to complain via <a href=\"https:\/\/erlycoder.com\/support\/\" title=\"Report a bug or suggest a feature\">Contact page<\/a>, if you do not agree.<\/li>\n<li>Error messages are updated for cases where the search keyword is not provided or the target language does not exist (for Polylang).<\/li>\n<li>WP compatibility update<\/li>\n<\/ul>\n\n<h4>1.15<\/h4>\n\n<ul>\n<li>Error messages fix.<\/li>\n<\/ul>\n\n<h4>1.14<\/h4>\n\n<ul>\n<li>Minor fix in handling post types.<\/li>\n<li>WPML &amp; Polylang compatibility fixes.<\/li>\n<\/ul>\n\n<h4>1.12<\/h4>\n\n<ul>\n<li>Minor fix in handling post types.<\/li>\n<\/ul>\n\n<h4>1.11<\/h4>\n\n<ul>\n<li>Fixed issues with type=any parameter.<\/li>\n<li>Fixed issues with multitype requests (Example: type=post,page).<\/li>\n<li>Default search type is changed to 'any'. Be careful updating the plugin.<\/li>\n<\/ul>\n\n<h4>1.10<\/h4>\n\n<ul>\n<li>Fixed bug \"Call to undefined function is_plugin_active()\".<\/li>\n<\/ul>\n\n<h4>1.9<\/h4>\n\n<ul>\n<li>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.<\/li>\n<\/ul>\n\n<h4>1.8<\/h4>\n\n<ul>\n<li>Added \"page\" and \"per_page\" parameters. Old ones \"page\" and \"per_page\" are still supported, but we strongly recommend to to use new ones.<\/li>\n<\/ul>\n\n<h4>1.7<\/h4>\n\n<ul>\n<li>Maintenance release.<\/li>\n<\/ul>\n\n<h4>1.6<\/h4>\n\n<ul>\n<li>Fixed taxonomy requests.<\/li>\n<li>One more example added<\/li>\n<\/ul>\n\n<h4>1.5<\/h4>\n\n<ul>\n<li>Multilingual websites support (WPML &amp; Polylang).<\/li>\n<li>Taxonomy filters.<\/li>\n<li>Search results ordering.<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Release<\/li>\n<\/ul>","raw_excerpt":"The plugin provides a REST API endpoint for the Relevanssi search plugin.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/91090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=91090"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/dzysyak"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=91090"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=91090"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=91090"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=91090"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=91090"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=91090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}