Back to contents

AJAX Search Query Overview

 

In this overview, you will find out about the AJAX Search Query for Elementor and Gutenberg and their general settings.

Tutorial requirements:

  • Elementor free version or Block Editor;
  • the JetSearch plugin installed and activated;
  • a Page built with the Block Editor or Elementor Page Builder free version to place the AJAX Search block/widget;
  • the content to search (i.e., WooCommerce products, pages, Custom Post Type posts with JetEngine, or default WordPress posts);
  • JetStyleManager for Gutenberg (optional).

The AJAX Search Query is the second block of settings of this widget. It focuses on including/excluding different sources in search results and customizing the number of search results displayed.

edit ajax search widget

The AJAX Search widget/block allows it to apply the search functionality to every site element. For example, this tutorial explains How to add an AJAX search to website’s header with JetSearch

AJAX Search Query Feature in Widget

Enter a page you need to add the AJAX Search widget.

After adding the AJAX Search widget on the page, scroll down the AJAX Search Query settings. 

Turn on the Search by the current query toggle to search in the current query only.

search query tab of ajax search widgets for elementor

To search in posts, pages, WooCommerce products, and CPTs created with JetEngine, do not turn on this toggle but specify the search scope in the Source field. The search area will cover the entire website content if this field is empty.

 source field of ajax search widgets for elementor

This tutorial explains How to Specify the Source in AJAX Search in Elementor and Gutenberg.

Keep in mind that this field allows applying some sources simultaneously. 

many sources for ajax search widgets for elementor

This tutorial explains How to Set the Search Only for Specific Post Types for Elementor and Gutenberg.

The following tabs are Include and Exclude. They have the same fields to specify the terms and custom fields for the search. These fields can be used simultaneously to search in terms and custom fields.

include and exclude tabs for ajax search widgets for elementor
search in terms field of include and exclude tabs

These tutorials explain How to Include Certain Terms in the AJAX Search Widget’s Search Query for Elementor and Gutenberg and How to Exclude Certain Terms and Posts in AJAX Search Query for Elementor and Gutenberg.

The Sentence Search toggle, if enabled, allows searching in sentences.

sentence search toggle of ajax search widgets for elementor
sentence search in elementor

If enabled, the toggle Search in taxonomy terms specifies the search area as categories, tags, formats, etc. 

search in taxonomy terms drop-down menu

This setting is connected with the Content section of the Search Form block. Therefore to provide the proper search, enable the Show Categories List toggle from the Search Form block and specify the area for the search (as categories, tags, etc.) from the drop-down menu.

show categories list of ajax search widgets for elementor

This tutorial explains How to Enable Search for Specific Taxonomies for Elementor and Gutenberg.

The last four settings cover the search result displaying:

search results displaying settings
  • Results Order By makes it possible to choose from the drop-down menu the way to present result order: by Relevance, ID, Author, Title, Date, Last modified, Rand, Number of Comments, and Menu Order;
  • Results Order sets the ASC (default) or DESC order;
  • Posts Per Page has a field to type the number of results displayed on one search page;
  • Posts Number has a field to type the number of results in one search query.

Turning on these settings proceeds with the necessary search results. 

search results displayed

AJAX Search Query Feature in Block

Enter the page you want to add the search bar block and add the Ajax Search block to the place you want.

 ajax search block for gutenberg

The Search Query is the second setting block of the AJAX Search block. It has two settings to specify the search areas: the Search by the custom query and the search in specific sources.

To search only in the current custom query, toggle the Search by the current query and type one or some custom fields in this field. This tutorial explains How to Set up a Field Key for Searching in Custom Fields for Gutenberg.

search query of ajax search block for gutenberg

This tutorial explains How to Manage Custom Fields in AJAX Search in Gutenberg and Elementor.

The search in specific sources covers the possibility to conduct searches in particular search areas such as posts, pages, landing pages, and custom posts developed with the JetEngine plugin. If this field is empty, the search will be conducted in all site data.

source field of ajax search block for gutenberg

Besides, searching in complete sentences is possible by turning on the toggle Sentence Search.

sentence search toggle in gutenberg
sentence search in gutenberg

If enabled, the next toggle Search in taxonomy terms makes it possible to include the search results in the posts with terms of the selected taxonomies.

search in taxonomy terms

The following four settings control the search result appearance. They are:

search result order toggles
  • Results Order By has the drop-down menu to arrange results by Relevance, ID, Author, Title, Date, Last modified, Rand, Number of Comments, and Menu Order;
  • Results Order to put results in the ASC or DESC order;
  • Posts Per Page to specify the number of results displayed on the search page;
  • Posts Number to type the number of results displayed in one search query.

This tutorial explains How to Sort the WordPress Search Results by Relevance for Elementor and Gutenberg.

The last tab of Search Query Includes/Excludes settings to include/exclude some terms into the search results. Besides, this tab allows excluding some posts.

To save changes, press the “Update” button. Then preview the built page to see the customized search results.

search results page built in gutenberg

Now you know how to customize the AJAX Search Query in Elementor and Gutenberg.