Stand with Ukraine. Fight for freedom and democracy

Donate
Back to contents

JetSearch: How to Sort the WordPress Search Results by Relevance

 

This step-by-step tutorial will explain how to sort the search results by relevance using the JetSearch plugin.

Tutorial requirements:

  • JetSearch — apply the fastest AJAX search and manage the way the results are displayed, using advanced stylization settings;
  • WordPress Gutenberg editor and JetStyleManager — style any Gutenberg block & adjust its visual rendition;
  • Elementor free — add the necessary widget into the editor, style it up, and publish it right away.

Arranging the Search Results by Relevance in Elementor

Step 1 – Firstly, check the presence and relevance of the necessary keywords in the posts that you want to display.

keywords in the posts

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.

Step 2 – 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.

header in the elementor editor

Step 3 – 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.

results order by relevance

Step 4 – You can filter search results using either descending or ascending order in the Results Order dropdown.

results order

Don’t forget to update the settings. Now you can sort the posts as you wish.

search results sorted by relevance

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.

ajax search block

Proceed to the Block tab and unfold the Search Query section.

search query of the AJAX search block

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.

results order by relevance in the ajax search

Below you will find Results Order, where you can filter search results using either descending or ascending order.

results order in Gutenberg

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.