SearchWP

This Documentation is for SearchWP Version 3

Customize the Aggressiveness of the Indexer

The SearchWP indexer defaults are configured for an average server. If you notice the indexer struggling to do it’s job you can reduce it’s aggressiveness by adding something like the following to your theme’s functions.php:

<?php
// pause the indexer for 1s in between passes
function my_searchwp_indexer_throttle() {
return 1;
}
add_filter( 'searchwp_indexer_throttle', 'my_searchwp_indexer_throttle' );
// only process 3 posts per indexer pass (instead of the default of 10)
function my_searchwp_index_chunk_size() {
return 3;
}
add_filter( 'searchwp_index_chunk_size', 'my_searchwp_index_chunk_size' );
// only process 200 terms at a time
function my_searchwp_process_term_limit() {
return 200;
}
add_filter( 'searchwp_process_term_limit', 'my_searchwp_process_term_limit' );
view raw gistfile1.php hosted with ❤ by GitHub

Alternatively, if you’re running a more powerful server you can modify these numbers to take advantage of the extra resources. Customizing these values allows you to fine tune the indexer’s performance to match your server’s capabilities without over-exhausting it.