- 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.
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.
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.
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.
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.
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.
If enabled, the toggle Search in taxonomy terms specifies the search area as categories, tags, formats, etc.
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.
This tutorial explains How to Enable Search for Specific Taxonomies for Elementor and Gutenberg.
The last four settings cover the search result displaying:
- 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.
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.
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.
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.
Besides, searching in complete sentences is possible by turning on the toggle Sentence Search.
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.
The following four settings control the search result appearance. They are:
- 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.
Now you know how to customize the AJAX Search Query in Elementor and Gutenberg.