How to Sort the WordPress Search Results by Relevance
Read how to sort the search results by relevance using the JetSearch plugin.
Before you start, check the tutorial requirements:
- Elementor (Free version) or Block editor (Gutenberg);
- JetSearch plugin installed and activated.
Arranging the Search Results by Relevance in Elementor
Firstly, check the presence and relevance of the necessary keywords in the posts that you want to display.
The keyword density helps you to set the order of the posts. It is significant to save the logical algorithm for relevant results.
To show the result as the first one in the list, prove that it contains the necessary keywords in the:
- title;
- content;
- excerpt.
To show the result as the next one in the list, add the keywords in the:
- content;
- excerpt.
The less relevant results should also contain the keywords. If you add the keywords to the content only, the excerpt or the title will reduce the importance of the result, and it will be shown below the more relevant ones.
Open the page where you added the search bar with the Elementor editor or simply search for the AJAX Search widget and drag and drop it to the needed section.
Proceed to the Content tab. Unfold Search Query, scroll down to the Results Order By and choose the “Relevance” option in the drop-down list.
You can filter search results using either descending or ascending order in the Results Order dropdown.
Don’t forget to update the settings. Now you can sort the posts as you wish.
Changing the Results Order in Gutenberg
As JetSearch works not only with the Elementor page builder, you can apply a Search block using Gutenberg as well.
To change the search results order, open the page with the AJAX Search block in the default WordPress editor.
Proceed to the Block tab and unfold the Search Query section.
The AJAX Search block for Gutenberg has the same settings as the AJAX Search widget for Elementor described above.
Scroll down the section and find the Results Order By option. Select “Relevance” from the drop-down list.
Below you will find Results Order, where you can filter search results using either descending or ascending order.
After completing all customizations, click the “Update” button and preview your search results according to the chosen order.
Now you know how to manage the search results and customize the content shown there by using the JetSearch plugin.