include/SugarSearchEngine/SugarSearchEngineFullIndexer.php

Show: inherited
Table of Contents

\SugarSearchEngineFullIndexer

Package: SugarCRM

Parent(s)
\RunnableSchedulerJob

Constants

Constant  MAX_BULK_THRESHOLD = 5000

The max number of beans we process before starting to bulk insert so we dont hit memory issues.

Constant  MAX_BULK_QUERY_THRESHOLD = 15000

The max number of beans we process before starting to bulk insert so we dont hit memory issues.

Constant  MAX_BULK_DELETE_THRESHOLD = 3000

The max number of beans we delete at a time

Constant  POSTPONE_JOB_TIME = 20

Number of time to postpone a job by so it's not executed twice during the same request.

Constant  QUEUE_TABLE = 'fts_queue'

The name of the queue table

Properties

Propertyprivate\SugarSearchEngineAbstractBase  $SSEngine= ''

Propertyprotected\DBManager  $db= ''

Details
Type
\DBManager
Propertyprivatearray  $results= ''

Details
Type
array
Propertyprivate\SchedulersJob  $schedulerJob= ''

Details
Type
\SchedulersJob
Propertypublicstring  $schedulerName= '"Full Text Search Indexer"'
static

Name of the scheduler to perform a full index

Default value"Full Text Search Indexer"Details
Type
string

Methods

methodpublic__construct( \SugarSearchEngineAqbstractBase $engine = null ) : void

Parameters
Name Type Description
$engine \SugarSearchEngineAqbstractBase
methodpublic__get(  $name ) : void

Parameters
Name Type Description
$name
methodprotectedclearFTSIndexQueue( ) : void

Remove all records that may be currently queued for FTS ingestion

methodpubliccreateJobQueueConsumerForModule(  $module ) : String

Create a job queue FTS consumer for a specific module

Parameters
Name Type Description
$module
Returns
Type Description
String Id of newly created job
methodprotectedgenerateFTSQuery(  $module,  $fieldDefinitions ) : string

Generate the query necessary to retrieve FTS enabled fields for a bean.

Parameters
Name Type Description
$module
$fieldDefinitions
Returns
Type Description
string
methodpublicgetStatistics( ) : array

Return statistics about how many records per module were indexed.

Returns
Type Description
array
methodpublicindexRecords(  $module,  $fieldDefinitions ) : void

Parameters
Name Type Description
$module
$fieldDefinitions
methodpublicinitiateFTSIndexer( array $modules = array(),  $deleteExistingData = TRUE ) : \SugarSearchEngineFullIndexer

Initiate the FTS indexer. Once initiated, all work will be done by the FTS consumers which will be invoked by the job queue system.

Parameters
Name Type Description
$modules array
$deleteExistingData
Returns
Type Description
\SugarSearchEngineFullIndexer
methodpublicisFTSIndexScheduleCompleted( ) : bool
static

Determine if a system has been indexed

Returns
Type Description
bool
Details
Static
 
methodpublicisFTSIndexScheduled( ) : mixed
static

TODO: Need to update Determine if a pre-existing scheduler for fts exists. If so return the id, else false.

Returns
Type Description
mixed
Details
Static
 
methodprotectedmarkBeansProcessed( \$beanIDs $beanIDs ) : void

Given a set of bean ids processed from the queue table, mark them as being processed. We will throttle the update query as there is a limit on the size of records that can be passed to an in clause yet we don't want to update them individually for performance reasons.

Parameters
Name Type Description
$beanIDs \$beanIDs

array of bean ids to delete

methodpublicperformFullSystemIndex(  $modules = array(),  $clearExistingData = TRUE ) : void

Index the entire system. This should only be called from a worker process as this is a time intensive process and does not take advantage of the job queue system. Currently this call is only used when populating demo data and should be used sparingly.

Parameters
Name Type Description
$modules
$clearExistingData
methodpublicpopulateIndexQueueForModule(  $module ) : void

Populate the index queue with all records from a particular module

Parameters
Name Type Description
$module
methodprotectedremoveExistingFTSConsumers( ) : void

Remove existing FTS Consumers that may have been created by a previous scheduled index.

methodpublicrun(  $module ) : void

Main function that handles the indexing of a bean and is called by the job queue system.

Parameters
Name Type Description
$module
methodprivatesetBeanIDsProcessed(  $deleteIDs ) : void

Internal function to mark records within queue table as processed.

Parameters
Name Type Description
$deleteIDs
methodpublicsetJob( \SchedulersJob $job ) : void

Set the scheduler job that initiated the run call.

Parameters
Name Type Description
$job \SchedulersJob
methodprotectedshouldIndexViaBean(  $module ) : bool

TODO: For the 6.5.1 release this logic will need to be updted as we support additional field types

Determine if a particular module should be indexed via its bean or if we can build a direct query. Indexing a module by going through SugarBean can introduce performance problems

Parameters
Name Type Description
$module
Returns
Type Description
bool
Documentation was generated by DocBlox 0.18.1.