include/SugarSearchEngine/SugarSearchEngineFullIndexer.php

Show: inherited
Table of Contents

\SugarSearchEngineFullIndexer

Package: SugarCRM

Indexer job for Search

Parent(s)
\SugarSearchEngineIndexerBase < \RunnableSchedulerJob
Api
 

Constants

Constant  MAX_BULK_THRESHOLD = 5000
inherited

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

Inherited from: \SugarSearchEngineIndexerBase::MAX_BULK_THRESHOLD
Constant  MAX_BULK_QUERY_THRESHOLD = 15000
inherited

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

Inherited from: \SugarSearchEngineIndexerBase::MAX_BULK_QUERY_THRESHOLD
Constant  MAX_BULK_DELETE_THRESHOLD = 3000
inherited

The max number of beans we delete at a time

Inherited from: \SugarSearchEngineIndexerBase::MAX_BULK_DELETE_THRESHOLD
Constant  POSTPONE_JOB_TIME = 20
inherited

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

Inherited from: \SugarSearchEngineIndexerBase::POSTPONE_JOB_TIME
Constant  QUEUE_TABLE = 'fts_queue'
inherited

The name of the queue table

Inherited from: \SugarSearchEngineIndexerBase::QUEUE_TABLE

Properties

Propertyprotected\SugarSearchEngineAbstractBase  $SSEngine= ''
Propertyprotected\DBManager  $db= ''
inherited

Inherited from: \SugarSearchEngineIndexerBase::$$db
Details
Type
\DBManager
Inherited_from
\SugarSearchEngineIndexerBase::$$db  
Propertyprotected\SchedulersJob  $schedulerJob= ''
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
Propertyprotected\table_name  $table_name= ''
Details
Type
\table_name
Inherited_from
\SugarSearchEngineIndexerBase::$$table_name  

Methods

methodpublic__construct( \SugarSearchEngineAqbstractBase $engine = null ) : void

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

Inherited from: \SugarSearchEngineIndexerBase::__get()
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
inherited

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

Inherited from: \SugarSearchEngineIndexerBase::generateFTSQuery()
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( String $module, array $fieldDefinitions ) : integer

Index records into search engine

Parameters
Name Type Description
$module String

module

$fieldDefinitions array

fieldDefinitions

Returns
Type Description
integer number of indexed records, -1 if fails
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
inherited

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.

Inherited from: \SugarSearchEngineIndexerBase::markBeansProcessed()
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.

Subclasses should implement their own logic.

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

Internal function to mark records within queue table as processed.

Inherited from: \SugarSearchEngineIndexerBase::setBeanIDsProcessed()
Parameters
Name Type Description
$deleteIDs
methodpublicsetJob( \SchedulersJob $job ) : void
inherited

Set the scheduler job that initiated the run call.

Inherited from: \SugarSearchEngineIndexerBase::setJob()
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.