SilverStripe Search

IndexingTrait

Table of Contents

Methods

indexClassForIndex()  : int|bool
Index the classes for a specific index
taskSetup()  : array<string|int, mixed>
Set up the requirements for this task
hasPCNTL()  : bool
Check if PCNTL is available and/or useable.
runForkedChild()  : void
Create a fork and run the child
spawnChildren()  : int
For each core, spawn a child process that will handle a separate group.

Methods

indexClassForIndex()

Index the classes for a specific index

protected indexClassForIndex(array<string|int, mixed> $classes, bool $isGroup, int $group) : int|bool
Parameters
$classes : array<string|int, mixed>

Classes that need indexing

$isGroup : bool

Indexing a specific group?

$group : int

Group to index

Tags
throws
Exception
throws
HTTPException|HttpClientException|HttpException
Return values
int|bool

taskSetup()

Set up the requirements for this task

protected taskSetup(HTTPRequest $request) : array<string|int, mixed>
Parameters
$request : HTTPRequest

Current request

Return values
array<string|int, mixed>

hasPCNTL()

Check if PCNTL is available and/or useable.

private hasPCNTL() : bool

The unittest param is from phpunit.xml.dist, meant to bypass the exit(0) call The pcntl parameter check is for unit tests, but PHPUnit does not support PCNTL (yet)

Return values
bool

runForkedChild()

Create a fork and run the child

private runForkedChild(string $class, array<string|int, mixed> &$pids, int $start) : void
Parameters
$class : string

Class to index

$pids : array<string|int, mixed>

Array of all the child Process IDs

$start : int

Start point for the objects

Tags
codeCoverageIgnore

Can't be tested because PCNTL is not available

throws
HTTPException
throws
ValidationException

spawnChildren()

For each core, spawn a child process that will handle a separate group.

private spawnChildren(string $class, int $group, int $groups) : int

This speeds up indexing through CLI massively.

Parameters
$class : string

Class to index

$group : int

Group to index

$groups : int

Total amount of groups

Tags
codeCoverageIgnore

Can't be tested because PCNTL is not available

throws
Exception
throws
HTTPException
Return values
int

Last group indexed


        
On this page

Search results