class SolrReindexGroupQueuedJob extends SolrReindexQueuedJobBase (View source)

Queuedjob to re-index a small group within an index.

This job is optimised for efficient full re-indexing of an index via Solr_Reindex.

Operates similarly to {\SilverStripe\FullTextSearch\Solr\Reindex\Jobs\SearchUpdateQueuedJobProcessor} but can not work with an arbitrary list of IDs. Instead groups are segmented by ID. Additionally, this task does incremental deletions of records.

Properties

protected bool $isComplete

Flag whether this job is done

from  SolrReindexQueuedJobBase
protected array $messages

List of messages

from  SolrReindexQueuedJobBase
protected LoggerInterface $logger

Logger to use for this job

from  SolrReindexQueuedJobBase
protected string $indexName

Name of index to reindex

protected type $state

Variant state that this group belongs to

protected string $class

Single class name to index

protected int $groups

Total number of groups

protected int $group

Group index

Methods

public
__construct($indexName = null, $state = null, $class = null, $groups = null, $group = null)

No description

protected
LoggerInterface
getLogger()

Gets a logger for this job

public
setLogger(LoggerInterface $logger)

Assign custom logger for this job

public
getJobData()

Return the current job state as an object containing data

public
setJobData(int $totalSteps, int $currentStep, bool $isComplete, stdClass $jobData, array $messages)

Sets data about the job

protected
getHandler()

Get the reindex handler

public
jobFinished()

Returns true or false to indicate that this job is finished

public
prepareForRestart()

Called whenever a job is restarted for whatever reason.

public
setup()

Setup this queued job. This is only called the first time this job is executed (ie when currentStep is 0)

public
afterComplete()

No description

public
getJobType()

What type of job is this? Options are

  • QueuedJob::IMMEDIATE
  • QueuedJob::QUEUED
  • QueuedJob::LARGE

public
string
getSignature()

Gets a unique signature for this job and its current parameters.

public
addMessage(string $message)

Add an arbitrary text message into a job

public
string
getTitle()

Gets a title for the job that can be used in listings

public
process()

A job is run within an external processing loop that will call this method while there are still steps left to complete in the job.

Details

__construct($indexName = null, $state = null, $class = null, $groups = null, $group = null)

No description

Parameters

$indexName
$state
$class
$groups
$group

protected SearchLogFactory getLoggerFactory()

No description

Return Value

SearchLogFactory

protected LoggerInterface getLogger()

Gets a logger for this job

Return Value

LoggerInterface

setLogger(LoggerInterface $logger)

Assign custom logger for this job

Parameters

LoggerInterface $logger

getJobData()

Return the current job state as an object containing data

stdClass ( 'totalSteps' => the total number of steps in this job - this is relayed to the user as an indicator of time 'currentStep' => the current number of steps done so far. 'isComplete' => whether the job is finished yet 'jobData' => data that the job wants persisted when it is stopped or started 'messages' => a cumulative array of messages that have occurred during this job so far )

setJobData(int $totalSteps, int $currentStep, bool $isComplete, stdClass $jobData, array $messages)

Sets data about the job

is an inverse of the getJobData() method, but being explicit about what data is set

Parameters

int $totalSteps
int $currentStep
bool $isComplete
stdClass $jobData
array $messages

protected SolrReindexHandler getHandler()

Get the reindex handler

Return Value

SolrReindexHandler

jobFinished()

Returns true or false to indicate that this job is finished

prepareForRestart()

Called whenever a job is restarted for whatever reason.

This is a separate method so that broken jobs can do some fixup before restarting.

setup()

Setup this queued job. This is only called the first time this job is executed (ie when currentStep is 0)

afterComplete()

No description

getJobType()

What type of job is this? Options are

  • QueuedJob::IMMEDIATE
  • QueuedJob::QUEUED
  • QueuedJob::LARGE

string getSignature()

Gets a unique signature for this job and its current parameters.

This is used so that a job isn't added to a queue multiple times - this for example, an indexing job might be added every time an item is saved, but it isn't processed immediately. We dont NEED to do the indexing more than once (ie the first indexing will still catch any subsequent changes), so we don't need to have it in the queue more than once.

If you have a job that absolutely must run multiple times, the AbstractQueuedJob class provides a time sensitive randomSignature() method that can be used for returning a random signature each time

Return Value

string

addMessage(string $message)

Add an arbitrary text message into a job

Parameters

string $message

string getTitle()

Gets a title for the job that can be used in listings

Return Value

string

process()

A job is run within an external processing loop that will call this method while there are still steps left to complete in the job.

Typically, this method should process just a small amount of data - after calling this method, the process loop will save the current state of the job to protect against potential failures or errors.