Documentation

CRM_Core_InnoDBIndexer
in package

The InnoDB indexer is responsible for creating and destroying full-text indices on InnoDB classes.

Table of Contents

Constants

IDX_PREFIX  = 'civicrm_fts_'

Properties

$indices  : array<string|int, mixed>
Indices.
$isActive  : bool
$singleton  : CRM_Core_InnoDBIndexer

Methods

__construct()  : mixed
Class constructor.
buildIndexSql()  : array<string|int, mixed>
Generate a "CREATE INDEX" statement for each desired FTS index.
dropIndexSql()  : array<string|int, mixed>
Generate a "DROP INDEX" statement for each existing FTS index.
findActualFtsIndexNames()  : array<string|int, mixed>
Get a list of FTS index names that are currently defined in the database.
fixSchemaDifferences()  : mixed
Fix schema differences.
getActive()  : bool
Getter for isActive.
hasDeclaredIndex()  : bool
Determine if an index is expected to exist.
normalizeIndices()  : array<string|int, mixed>
Put the indices into a normalized format.
onToggleFts()  : void
(Setting Callback) Respond to changes in the "enable_innodb_fts" setting
reconcileIndexSqls()  : array<string|int, mixed>
Construct a set of SQL statements which will create (or preserve) required indices and destroy unneeded indices.
setActive()  : mixed
Setter for isActive.
singleton()  : CRM_Core_InnoDBIndexer

Constants

Properties

$indices

Indices.

protected array<string|int, mixed> $indices

(string $table => array $indices)

ex: $indices['civicrm_contact'][0] = array('first_name', 'last_name');

Methods

__construct()

Class constructor.

public __construct(bool $isActive, array<string|int, mixed> $indices) : mixed
Parameters
$isActive : bool
$indices : array<string|int, mixed>

buildIndexSql()

Generate a "CREATE INDEX" statement for each desired FTS index.

public buildIndexSql(mixed $table) : array<string|int, mixed>
Parameters
$table : mixed
Return values
array<string|int, mixed>

(string $indexName => string $sql)

dropIndexSql()

Generate a "DROP INDEX" statement for each existing FTS index.

public dropIndexSql(string $table) : array<string|int, mixed>
Parameters
$table : string
Return values
array<string|int, mixed>

(string $idxName => string $sql)

findActualFtsIndexNames()

Get a list of FTS index names that are currently defined in the database.

public findActualFtsIndexNames(string $table) : array<string|int, mixed>
Parameters
$table : string
Return values
array<string|int, mixed>

(string $indexName => string $indexName)

fixSchemaDifferences()

Fix schema differences.

public fixSchemaDifferences() : mixed

Limitation: This won't pick up stale indices on tables which are not declared in $this->indices. That's not much of an issue for now b/c we have a static list of tables.

getActive()

Getter for isActive.

public getActive() : bool
Return values
bool

hasDeclaredIndex()

Determine if an index is expected to exist.

public hasDeclaredIndex(string $table, array<string|int, mixed> $fields) : bool
Parameters
$table : string
$fields : array<string|int, mixed>

List of field names that must be in the index.

Return values
bool

normalizeIndices()

Put the indices into a normalized format.

public normalizeIndices(mixed $indices) : array<string|int, mixed>
Parameters
$indices : mixed
Return values
array<string|int, mixed>

onToggleFts()

(Setting Callback) Respond to changes in the "enable_innodb_fts" setting

public static onToggleFts(bool $oldValue, bool $newValue) : void
Parameters
$oldValue : bool
$newValue : bool

reconcileIndexSqls()

Construct a set of SQL statements which will create (or preserve) required indices and destroy unneeded indices.

public reconcileIndexSqls(string $table) : array<string|int, mixed>
Parameters
$table : string
Return values
array<string|int, mixed>

setActive()

Setter for isActive.

public setActive(bool $isActive) : mixed
Parameters
$isActive : bool

        
On this page

Search results