Source analyzer

The Source Analyzer is a script executed when you visit the FiboFilters settings page. It analyzes filter sources to determine the most relevant facet types (e.g., Checkboxes, Radio, Number) for each filter. This ensures that only appropriate options are displayed, simplifying filter setup.

For example, if all values for a given filter are strings, the Range type will not be available under “Facet type”, as it is not applicable.

Performance optimization

To enhance performance, the script does not run every time the settings page is accessed. Instead, the results are stored in a transient for one hour, reducing redundant computations and improving load times. The transient is called fibofilters_sources_analyse_data.

FiboFilters caches applicable facet types in the transient for one hour. As a result, certain facet types may not appear in the list if the cached data is outdated. To resolve this issue, you can manually delete the transient. There are two ways to do this:

With WP-CLI:

wp transient delete fibofilters_sources_analyse_data

With PHP:

delete_transient( 'fibofilters_sources_analyse_data' )

Disabling filter analyzer

Disabling source analyzer manually

In cases where the dataset is large, the analysis process may take a significant amount of time, potentially causing issues when accessing the settings page and making the Filter Builder inaccessible:

FiboFilters Source Analyzer

If this becomes problematic, the Source Analyzer can be disabled using the following code snippet:

add_filter( 'fibofilters/analyse_source_value_types', '__return_false' );

Learn how to add this snippet to your WordPress.

Once this is done, FiboFilters will display the following message in the filter builder:

Disabling the Source Analyzer will cause FiboFilters to display default facet types for the filters.

Disabling source analyzer automatically

If the Source Analyzer runs for 20 seconds without any effect, FiboFilters displays an error message at the bottom of the page:

After that, FiboFilters disables the Source Analyzer automatically and displays the following message:

FiboFilters: source analyzer disabled automatically

If you still want the Source Analyzer to run, you can reduce the number of sources analyzed in one go. The default number is 15. You can decrease it to eg. 1 with the following code snippet:

add_filter( 'fibofilters/source_analyser/max_sources_to_analyse_per_set', fn() => 1 );

Learn how to add this snippet to your WordPress.