include/SugarSearchEngine/SugarSearchEngineFullIndexer.php
\SugarSearchEngineFullIndexer
Indexer job for Search
- Parent(s)
- \SugarSearchEngineIndexerBase < \RunnableSchedulerJob
- Api
Constants
MAX_BULK_THRESHOLD
= 5000
The max number of beans we process before starting to bulk insert so we dont hit memory issues.
Inherited from: \SugarSearchEngineIndexerBase::MAX_BULK_THRESHOLD- Inherited_from
- \SugarSearchEngineIndexerBase::MAX_BULK_THRESHOLD
MAX_BULK_QUERY_THRESHOLD
= 15000
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- Inherited_from
- \SugarSearchEngineIndexerBase::MAX_BULK_QUERY_THRESHOLD
MAX_BULK_DELETE_THRESHOLD
= 3000
The max number of beans we delete at a time
Inherited from: \SugarSearchEngineIndexerBase::MAX_BULK_DELETE_THRESHOLD- Inherited_from
- \SugarSearchEngineIndexerBase::MAX_BULK_DELETE_THRESHOLD
POSTPONE_JOB_TIME
= 20
Number of time to postpone a job by so it's not executed twice during the same request.
Inherited from: \SugarSearchEngineIndexerBase::POSTPONE_JOB_TIME- Inherited_from
- \SugarSearchEngineIndexerBase::POSTPONE_JOB_TIME
Properties
\SugarSearchEngineAbstractBase
$SSEngine= ''
- Type
- \SugarSearchEngineAbstractBase
- Inherited_from
- \SugarSearchEngineIndexerBase::$$SSEngine
\DBManager
$db= ''
- Type
- \DBManager
- Inherited_from
- \SugarSearchEngineIndexerBase::$$db
\SchedulersJob
$schedulerJob= ''
- Type
- \SchedulersJob
- Inherited_from
- \SugarSearchEngineIndexerBase::$$schedulerJob
string
$schedulerName= '"Full Text Search Indexer"'
Name of the scheduler to perform a full index
"Full Text Search Indexer"
Details- Type
- string
\table_name
$table_name= ''
- Type
- \table_name
- Inherited_from
- \SugarSearchEngineIndexerBase::$$table_name
Methods
__construct(
\SugarSearchEngineAqbstractBase $engine
=
null
)
:
void
Name | Type | Description |
---|---|---|
$engine | \SugarSearchEngineAqbstractBase |
__get(
$name
)
:
void
Name | Type | Description |
---|---|---|
$name |
createJobQueueConsumerForModule(
$module
)
:
String
Create a job queue FTS consumer for a specific module
Name | Type | Description |
---|---|---|
$module |
Type | Description |
---|---|
String | Id of newly created job |
generateFTSQuery(
$module, $fieldDefinitions
)
:
string
Generate the query necessary to retrieve FTS enabled fields for a bean.
Inherited from: \SugarSearchEngineIndexerBase::generateFTSQuery()Name | Type | Description |
---|---|---|
$module | ||
$fieldDefinitions |
Type | Description |
---|---|
string |
getStatistics(
)
:
array
Return statistics about how many records per module were indexed.
Type | Description |
---|---|
array |
indexRecords(
String $module, array $fieldDefinitions
)
:
integer
Index records into search engine
Name | Type | Description |
---|---|---|
$module | String | module |
$fieldDefinitions | array | fieldDefinitions |
Type | Description |
---|---|
integer | number of indexed records, -1 if fails |
initiateFTSIndexer(
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.
Name | Type | Description |
---|---|---|
$modules | array | |
$deleteExistingData |
Type | Description |
---|---|
\SugarSearchEngineFullIndexer |
isFTSIndexScheduleCompleted(
)
:
bool
Determine if a system has been indexed
Type | Description |
---|---|
bool |
- Static
isFTSIndexScheduled(
)
:
mixed
TODO: Need to update Determine if a pre-existing scheduler for fts exists. If so return the id, else false.
Type | Description |
---|---|
mixed |
- Static
markBeansProcessed(
\$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.
Inherited from: \SugarSearchEngineIndexerBase::markBeansProcessed()Name | Type | Description |
---|---|---|
$beanIDs | \$beanIDs | array of bean ids to delete |
performFullSystemIndex(
$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.
Name | Type | Description |
---|---|---|
$modules | ||
$clearExistingData |
populateIndexQueueForModule(
$module
)
:
void
Populate the index queue with all records from a particular module
Name | Type | Description |
---|---|---|
$module |
removeExistingFTSConsumers(
)
:
void
Remove existing FTS Consumers that may have been created by a previous scheduled index.
run(
$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.
Name | Type | Description |
---|---|---|
$module |
setBeanIDsProcessed(
$deleteIDs
)
:
void
Internal function to mark records within queue table as processed.
Inherited from: \SugarSearchEngineIndexerBase::setBeanIDsProcessed()Name | Type | Description |
---|---|---|
$deleteIDs |
setJob(
\SchedulersJob $job
)
:
void
Set the scheduler job that initiated the run call.
Inherited from: \SugarSearchEngineIndexerBase::setJob()Name | Type | Description |
---|---|---|
$job | \SchedulersJob |
shouldIndexViaBean(
$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
Name | Type | Description |
---|---|---|
$module |
Type | Description |
---|---|
bool |