SearchWP Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP’s many hooks

\SearchWP\Indexer

\SearchWP\Indexer facilitates the indexing process of SearchWP. SearchWP’s indexer works alongside hooks set up in \SearchWP\Sources to automatically keep the search Index up to date.

Basic Usage

If you are working with site customizations that do not align with the delta update hooks set up in \SearchWP\Sources you may want to force an Index update. This can be done like so:

<?php
// @linkhttps://searchwp.com/documentation/classes/searchwp-indexer/
// Forcefully trigger SearchWP's Indexer.
$indexer = new \SearchWP\Indexer();
$indexer->trigger();
view raw functions.php hosted with ❤ by GitHub

When the \SearchWP\Indexer is triggered, any necessary delta updates will be queued and applied as though they were triggered by native hooks.

Arguments

There are no arguments when instantiating a new \SearchWP\Indexer.

Properties

There are no public properties in \SearchWP\Indexer.

Methods

When working with \SearchWP\Indexer there are a number of methods to consider.

pause
Pause the indexing process.
unpause
Unpause the indexing process.

Hooks

There are a number of hooks available to further modify the behavior of \SearchWP\Indexer:

Create a Better WordPress Search Experience Today

Never lose visitors to unhelpful search results again. SearchWP makes creating your own smart WordPress search fast and easy.

Get SearchWP Now
Multiple Search Engines Icon