SearchUpdater
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
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Called by the ProxyDBExtension database connector with every manipulation made against the database.
Send updates to the current search processor for execution
Throw away the recorded dirty IDs without doing anything with them.
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, .....).
mixed
stat(string $name)
deprecated
deprecated
Get inherited config value
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
$this
set_stat(string $name, mixed $value)
deprecated
deprecated
Update the config value for a given property
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
static
process_writes(array $writes)
Send updates to the current search processor for execution
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.