Refers to FiboSearch Pro only

Indexing

FiboSearch plugin has its own independent search index. The index is built automatically after the first plugin installation, every plugin update and after changing some settings. 

Later amendments to products, attributes, and terms are also taken into account, so it is not necessary to rebuild the index after editing a product or term. The indexer listens for changes on actions hook: save_post, deleted_post, edited_term, created_term and delete_term

To see the current status of the search index, go to WooCommerce -> FiboSearch -> Indexer (tab)

Learn about the operations you can do on the index.

WP-CLI Commands

Since FiboSearch v1.19.0

# Rebuilding the entire index
wp fibosearch index build [--show-logs] [--hide-progress] [--disable-parallel]

# Update or delete the indicated posts in the index
# <id>: One or more IDs of posts to update in index (comma-separated)
wp fibosearch index delete <id> [--hide-progress]
wp fibosearch index update <id> [--hide-progress]

# Other commands
wp fibosearch index get-info status
wp fibosearch index show-logs

Indexing programmatically using WordPress hooks

Since FiboSearch v1.19.0

// Rebuilding the entire index. Use in later hook than plugins_loaded priority 15
// WARNING: This actions should be called later than plugins_loaded hook with priority 15
do_action( 'dgwt/wcas/indexer/build' );

// Update or delete the indicated posts in the index
// WARNING: These actions should be called later than init hook with priority 11
do_action( 'dgwt/wcas/indexer/update', $product_id );
do_action( 'dgwt/wcas/indexer/delete', $product_id );

Recurring indexing with WP Cron

Since FiboSearch v1.19.0

The following code will set up an hourly indexing using WP Cron:

add_action( 'init', function() {
  add_action( 'fibosearch_rebuild_index_cron', 'fibosearch_rebuild_index' );
  if (! wp_next_scheduled ( 'fibosearch_rebuild_index_cron' )) {
    wp_schedule_event( time(), 'hourly', 'fibosearch_rebuild_index_cron' );
  }
}, 20 );

function fibosearch_rebuild_index() {
  do_action( 'dgwt/wcas/indexer/build' );
}
  1. Open the functions.php file in your child theme and add the code at the end
  2. Or install the Code Snippets plugin and apply this code as a snippet.

If you would like to unschedule the recurring indexing, remove the above snippet and use the following code instead:

add_action( 'init', function() {
  $timestamp = wp_next_scheduled( 'fibosearch_rebuild_index_cron' );
  if ($timestamp) {
    wp_unschedule_event( $timestamp, 'fibosearch_rebuild_index_cron' );
  }
}, 30 );

Both snippets can be executed only once and can be removed after page reload.