Customize the Aggressiveness of the Indexer

Last updated December 18, 2018 « Knowledge Base

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.

Fix Search on Your Site. No Coding Required!

Now you can utilize all of the content that's gone unrecognized by native WordPress search instantly with SearchWP

Get SearchWP