Help Center

How to Set Indexer Option for Filters

From this tutorial, you will learn how to configure the JetSmartFilters Indexer option for filters and use it to index products or posts with JetSmartFilters functionality.

Before you start, check the tutorial requirements:

If you run an online shop or blog where you would like to add filters to sort products or posts, you can use the JetSmartFilters plugin. Let us introduce you to the Indexer, which is available in JetSmartFilters.

With this feature, you get the opportunity to save the filtering data in the database for further retrieval. In other words, only the results relevant to the selected filter will be displayed on the front end. The non-relevant results can be hidden or disabled.

This setup can be especially useful for WooCommerce filters indexer scenarios, as well as for blogs, directories, and custom listings.

We present an example based on filtering posts using JetSmartFilters.

Indexer Settings Overview

The first thing you should do is head to the WordPress Dashboard > Crocoblock > JetPlugins Settings directory. Go to the JetSmartFilters tab and open the Indexer Settings

Here, you need to activate the Use Indexed filters toggle. 

Another helpful option is to enable auto-indexing by toggling the Use auto re-indexing switcher. This feature will do the indexing itself without any further actions on your part.

Also, there is an Index Post Types list, where you can specify the post types that will be indexed.

This is the main part of the JetSmartFilters Indexer configuration, as it defines how the plugin stores and updates filter-related data.

After activating all the needed toggles, the changes will be saved automatically.

indexer settings tab

Managing JetSmartFilters Block in WordPress Dashboard

Proceed to the Smart Filters tab in the WordPress Dashboard. Here, you create the needed filters. 

Click the “Index Filters” button to apply the indexer functionality after activating the JetSmartFilters plugin.

You should also click this button:

  • after customizing filters or queries;
  • after importing posts;
  • after performing bulk updates;
  • after publishing posts via JetFormBuilder forms (auto re-indexing does not trigger in this case).

If you have toggled the Use auto re-indexing switcher in the Indexer Settings, you don’t need to click the “Index Filters” every time. The auto-indexer will update the data itself.

apply indexer button

When Auto Re-indexing Does Not Trigger

Auto re-indexing works when the posts are saved via the WordPress Dashboard. It does not work in such cases:

  • Post is published via the JetFormBuilder form on the front end;
  • Posts are imported via CSV or WP All Import;
  • Posts are updated via REST API or WP-CLI.

In these cases, you should press the “Apply Indexer” button manually or set up a PHP trigger.

Adjusting Filter Widget

It is time to open the page where you have filters. We will take a Checkboxes Filter as an example.

Warning

The Indexer option is available only in Checkboxes Filter, Select Filter, Check Range Filter, Visual Filter, and Radio Filter widgets.

In the JetSmartFilters widget’s settings, you find the Indexer Options tab, where you should enable the Apply Indexer option. 

The Show Counter option allows showing the number of items of each product. Also, you can show, hide, or disable an item in the filter if it is empty.

In addition, select whether counters should be changed when filters are applied in the Change Counters drop-down list.

indexer options tab in the checkbox filter widget

Connecting the Indexer with the Custom Query and the Provider

Another important step is to connect the filter, its provider, and query (if you work with the query) with the same ID.

So, when working with the query, set the desired ID in the Query ID field.

custom query id field

In the filter settings, enter the same ID in the Query ID field.

query id field in the filter settings

In the provider settings, set the ID in the CSS ID field of the Advanced settings if you work with Elementor.

css id field in the listing grid settings

If you work with Bricks, you can complete the CSS ID field in the CSS section of the STYLE tab.

css id field in bricks
Warning

If there are several Listing Grids/Loop Grids on the page, and not all of them should be filtered, you should put a unique ID on every non-filtered widget/block/element in the CSS ID field in the settings. Otherwise, the indexer can conflict with other queries, and the counter will show “0.”

other css id attached to the listing grid

When you have set all the needed adjustments, click the “Publish” button.

Viewing Result on Front End

Let’s view how the indexer option looks on the front end. When you open the page on the front end, you will see that the indexer now displays how many posts are attached to the specific filter options.

indexer and listing grid on the front end

After you select one of the options, you’ll see the filtered provider.

indexer working on the front end

Important Notes

  • The Indexer is available only for “Checkboxes”, “Select”, “Check Range”, “Visual”, and “Radio” filters;
  • Meta field values used as filter options should be written in Latin without spaces or special characters. Otherwise, the indexer will ignore them;
  • If the indexer doesn’t work, check our Indexer Does Not Work troubleshooting.

Now you know how to show the number of items for each product using JetSmartFilters Indexer functionality on your WordPress website.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 30K+ Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.