As you can see, the search results are always the same, no matter what the search term is. So clearly Relevanssi is not getting the search terms from Elementor.
How is your search results template built? Make sure it uses the default WP Query as the source, as that’s where the Relevanssi results are.
Hi, thanks for your reply
It’s using this as the query – https://snipboard.io/JWgPCH.jpg
These are the options available – https://snipboard.io/Xh1wVg.jpg
I assume I need to select ‘Current Query’?
I’ve switched to this, but now no results are found. https://www.speechy.com/?s=mother+of+the+bride&e_search_props=03b2537-30568
Is this now using Relevanssi search, or is it something I need to raise with Elementor?
Looks like the search is now powered by Relevanssi and is showing the correct results. You can confirm by checking if the Relevanssi admin search (Dashboard > Admin search) shows the same results.
Great!
I’ve tried a search term this morning and it’s displaying results now (not sure why yesterday it said no results found..)
I’ve run a search term via Admin Search – see screenshot – https://snipboard.io/uw37kV.jpg This looks great. The top 7 results all show an item which has the search term ‘mother of the bride’ within the title.
However it doesn’t seem to be matching exactly here
https://www.speechy.com/?s=mother+of+the+bride&e_search_props=03b2537-30568
For me it’s showing
- products and services
- mother of the bride speech template
- father of the bride speech template
- best men podcast
- write a funny speech
- bride speech templates
- etc etc
I’ve tried adjusting my settings here so it only searches within the title (see screenshot below), but it doesn’t seem to let me set 0 and defaults back to 1
https://snipboard.io/p74haA.jpg
Any other ideas?
Appreciate your help
It’s the Elementor’s e_search_props parameter. It adds something extra to the search. Without it, you’re seeing pure Relevanssi results: https://www.speechy.com/?s=mother+of+the+bride.
Remove the parameter from the search (Elementor support should be able to help you with that), and you’ll be fine.
OK, I’ll reach out to Elementor. Appreciate all your help.
I just have one final question.. When using the dashboard admin search for the term ‘mother of the bride’, the results return a custom post type, then 4 x posts, then a page, then a product. Is there any way I can force it to show page and products first?
Great, thanks! I’ll give that a try.
I’ve had a reply back from Elementor…
I regret to inform you that 3rd party plugins and their features are outside our support scope and that we can’t guarantee how they will work with Elementor.
So, I won’t be able to help you further with this issue, and I suggest you contact the plugin’s original authors and check if their plugin can be used with Elementor search.
If it is fully compatible, they should be able to provide you with some guide or tutorial on how to configure it and what to do to make it work.
Well, it’s all about an Elementor feature, and not much to do with third party plugins. But that’s the usual experience with Elementor support, sure, they’re very keen to say it’s not their business.
Hi, hmm OK!
I’ve managed to find another work around. I’ve registered a new widget, added a search bar to the widget, and pulled this into my header instead. This seems to output the same search results as the Admin Search.
I’ve looked at the link you sent regarding post priorities. I’ve added this to my functions.php page, but it doesn’t seem to be working.. am I doing something wrong?
add_filter( ‘relevanssi_comparison_order’, function( $order ) {
$order = array(
‘product’ => 0,
‘page’ => 1,
‘speech-advice’ => 2,
‘post’ => 3,
);
return $order;
} );
(Search results page –https://www.speechy.com/?s=mother+of+the+bride)
The function is correct, now you just need to set the orderby to post_type: https://www.speechy.com/?s=mother+of+the+bride&orderby=post_type&order=asc.
Add this to set the order to sort by post_type first:
add_filter( 'relevanssi_modify_wp_query', function( $query ) {
$query->set( 'orderby', array( 'post_type' => 'asc', 'relevanssi' => 'desc' ) );
return $query;
} );
Hi, I’ve added the other piece of code to functions.php, but my search form isn’t picking up the orderby part…
https://www.speechy.com/testing (use the top form next to the menu)
If the relevanssi_modify_wp_query function does nothing, your search is likely not Relevanssi.
Does the Relevanssi admin search get you the correct results? If not, try entering orderby=post_type&order=asc in the “Search parameters” field.
Hi,
Yes, the Admin search results are outputting the same results. It looks to be working OK now.
One final query..(hopefully!) When I search for ‘mother of the bride’ https://www.speechy.com/?s=mother+of+the+bride, the 5th result is ‘Bride Speech Advice’, however when I open up this page, the term ‘mother of the bride’ isn’t mentioned on this page at all, so surely it shouldn’t be displaying this in the search results?
You’re not doing a phrase search, so all posts that contain the words “mother” and “bride” are included. You can use quotes around the search phrase to restrict the search.
However, it seems the post also comes up when searching for "mother of the bride". Looking at the page source code, the phrase only appears in menus (which Relevanssi doesn’t seem to be indexing, as all the phrases in the menu don’t result in search matches) and in image ALT texts (which Relevanssi ignores by default). Does the phrase perhaps appear in the custom fields of the post?