class SearchUpdater (View source)

This class is responsible for capturing changes to DataObjects and triggering index updates of the resulting dirty index items.

Attached automatically by Injector configuration that overloads your flavour of Database class. The SearchManipulateCapture_[type] classes overload the manipulate method - basically we need to capture a manipulation after all the augmentManipulation code (for instance Version's) is run

Pretty closely tied to the field structure of SearchIndex.

Traits

Provides extensions to this object to integrate it with standard config API methods.

Config options

flush_on_shutdown bool

Whether to register the shutdown function to flush. Can be disabled for example in unit testing.

enabled bool

Whether the updater is enabled. Set to false for local development if you don't have a Solr server.

Properties

public static $registered
public static SearchUpdateProcessor $processor

Methods

public static 
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

public
mixed
stat(string $name) deprecated

Get inherited config value

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public
$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

public static 
handle_manipulation($manipulation)

Called by the ProxyDBExtension database connector with every manipulation made against the database.

public static 
process_writes(array $writes)

Send updates to the current search processor for execution

public static 
clear_dirty_indexes()

Throw away the recorded dirty IDs without doing anything with them.

public static 
flush_dirty_indexes()

Do something with the recorded dirty IDs, where that "something" depends on the value of self::$update_method, either immediately update the indexes, queue a messsage to update the indexes at some point in the future, or just throw the dirty IDs away.

Details

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

static handle_manipulation($manipulation)

Called by the ProxyDBExtension database connector with every manipulation made against the database.

Check every index to see what objects need re-inserting into what indexes to keep the index fresh, but doesn't actually do it yet.

TODO: This is pretty sensitive to the format of manipulation that DataObject::write produces. Specifically, it expects the actual class of the object to be present as a table, regardless of if any fields changed in that table (so a class => array( 'fields' => array() ) item), in order to find the actual class for a set of table manipulations

Parameters

$manipulation

static process_writes(array $writes)

Send updates to the current search processor for execution

Parameters

array $writes

static clear_dirty_indexes()

Throw away the recorded dirty IDs without doing anything with them.

static flush_dirty_indexes()

Do something with the recorded dirty IDs, where that "something" depends on the value of self::$update_method, either immediately update the indexes, queue a messsage to update the indexes at some point in the future, or just throw the dirty IDs away.