Refers to FiboSearch Pro only

Expand shortcodes when indexing

In FiboSearch Pro, shortcodes are ignored in the indexing process. This means, for example, if you have  an accordion shortcode in a product description, you will not be able to search for keywords contained in this accordion.

The solution is to add the shortcode to the whitelist. This works for FiboSearch Pro v1.13 or higher. Here is how you can do it. Suppose you use the following shortcode in your product description:

[lightweight-accordion title="Sample title"]
Sample content
[/lightweight-accordion]

You have to apply the following snippet that adds the name of your shortcode to the whitelist:

add_filter( 'dgwt/wcas/indexer/allowed_shortcodes', function ( $shortcodes ) {
    $shortcodes[] = 'lightweight-accordion';

    return $shortcodes;
} );

Learn how to add this snippet to your WordPress.

After adding the code, go to WooCommerce > FiboSearch > Indexer and rebuild the index.

Expand TablePress shortcodes

TablePress requires a different approach. To search in TablePress contents, you’ll need to use the following snippet:

// Allow [table] shortcode indexing
add_filter( 'dgwt/wcas/indexer/allowed_shortcodes', function ( $shortcodes ) {
    $shortcodes[] = 'table';
    return $shortcodes;
} );

// Init TablePress shortcodes
function fibosearch_init_tablepress_shortcodes() {
    if ( defined( 'TABLEPRESS_ABSPATH' ) ) {
        if ( ! isset( TablePress::$model_options ) ) {
            include_once TABLEPRESS_ABSPATH . 'classes/class-model.php';
            include_once TABLEPRESS_ABSPATH . 'models/model-options.php';
            TablePress::$model_options = new TablePress_Options_Model();
        }
        $tablepress_controller = TablePress::load_controller( 'frontend' );
        $tablepress_controller->init_shortcodes();
    }
}

// Init TablePress before batch indexing
add_action( 'dgwt/wcas/searchable_index/bg_processing/before_task', function () {
    fibosearch_init_tablepress_shortcodes();
} );

// Init TablePress while single product update
add_action( 'dgwt/wcas/tnt/background_product_update', function ( $action, $postID ) {
    if ( $action !== 'update' ) {
        return;
    }
    fibosearch_init_tablepress_shortcodes();
}, 5, 2 );

Learn how to add this snippet to your WordPress.

After adding the code, go to WooCommerce > FiboSearch > Indexer and rebuild the index. The index needs to be rebuilt each time you change a table.