Skip Navigation

[Resolved] Relevanssi search not working by shortcode attribute or url parameter

This thread is resolved. Here is a description of the problem and solution.

Problem:
There is an issue where a View outputs “No results found” when querying by a custom field indexed by Relevanssi.

This issue happens under the following conditions:

You have a custom field attached to a post type.
You use Rellevanssi to configure the field to be indexable.
You created a View with a custom search and added the following query filter to it:
“Search for a text, set by the View shortcode attribute:”
You added the View to a page and passed the field value in a shortcode
On the front-end, the search will not work and you will get no results found.

Solution:
Follow this erratum:
https://toolset.com/errata/a-view-querying-a-custom-field-indexed-by-relevanssi-shows-no-results/

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 5 replies, has 2 voices.

Last updated by Beda 5 years, 5 months ago.

Assisted by: Beda.

Author
Posts
#1187336

Hi I have a views custom search using relevanssi. It works fine with the normal views search box.

However if I try to use with a shortcode attribute (search='xxx". EG1) or url parameter(EG2) then it just returns non relevanssi simple search. How can I activate the relevanssi search in these cases?

EG1 I want to show related posts and use search term based on current posts' title
EG2 if I have search box on my home page, then I want to pass the search term to my normal search page as url paramter)

#1187345

Toolset Relevannis only works with the Post Title and Content Search box.
https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/#integration-with-custom-searches.

I can, however, confirm that this works only if you choose "I'll add the search box to the HTML manually" or "Search for a specific text", not if you choose "Search for a text, set by the View shortcode attribute"

I reported this to be analysed.
Another supporter will be assigned to this ticket soon, so to keep you updated with eventual fix releases.

#1193539
#1212074

Just a follow up: I found this hook that can be used to trigger the relevanssi: relevanssi_search_ok

hidden link

#1212075

My issue is resolved now. Thank you!

#1300377

This is now resolved in Views 2.9