include/SugarSearchEngine/Elastic/SugarSearchEngineElastic.php

Show: inherited
Table of Contents

\SugarSearchEngineElastic

Package: SugarCRM

Engine implementation for ElasticSearch

Parent(s)
\SugarSearchEngineAbstractBase < \SugarSearchEngineInterface

Constants

Constant  DEFAULT_INDEX_TYPE = 'SugarBean'
Constant  WILDCARD_CHAR = '*'
Constant  MAX_BULK_THRESHOLD = 100
inherited

The max number of documents to bulk insert at a time

Inherited from: \SugarSearchEngineAbstractBase::MAX_BULK_THRESHOLD

Properties

Propertyprivate  $_client= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $_config= 'array()'
Default valuearray()Details
Type
n/a
Propertyprotectedarray  $_documents= 'array()'
Default valuearray()Details
Type
array
Inherited_from
\SugarSearchEngineAbstractBase::$$_documents  
Propertyprivate  $_indexName= '""'
Default value""Details
Type
n/a
Propertyprivate  $_indexType= ''SugarBean''
Default value'SugarBean'Details
Type
n/a

Methods

methodpublic__construct(  $params = array() ) : void

Parameters
Name Type Description
$params
methodpublic__destruct( ) : void
inherited

Bulk insert any documents that have been marked for bulk insertion.

Inherited from: \SugarSearchEngineAbstractBase::__destruct()
methodpublic__wakeup( ) : void
inherited

This is needed to prevent unserialize vulnerability

Inherited from: \SugarSearchEngineAbstractBase::__wakeup()
methodprotectedaddRecordsToQueue( \$records $records ) : void
inherited

This function adds records to FTS queue.

Inherited from: \SugarSearchEngineAbstractBase::addRecordsToQueue()
Parameters
Name Type Description
$records \$records

array of records

methodpublicbulkInsert(  $docs ) : void

(non-PHPdoc)

Parameters
Name Type Description
$docs
Details
See
\SugarSearchEngineInterface::bulkInsert()  
methodprotectedcanAppendWildcard( String $queryString ) : Boolean

This function determines whether we should append wildcard to search string.

Parameters
Name Type Description
$queryString String
Returns
Type Description
Boolean
methodprotectedcheckException( \$e $e ) : boolean

Check if this is an Elastic client exception, disable FTS if it is

Parameters
Name Type Description
$e \$e

Exception

Returns
Type Description
boolean tru if it's an Elastic client exception, false otherwise
methodprotectedcleanTeamSetID(  $teamSetID ) : mixed

Remove the '-' from our team sets.

Parameters
Name Type Description
$teamSetID
Returns
Type Description
mixed
methodprotectedconstructHighlightArray(  $fields,  $options ) : \Elastica_Document | null

Given fields and options, this function constructs and returns a highlight array that can be passed to search engine.

Parameters
Name Type Description
$fields
$options
Returns
Type Description
\Elastica_Document | null
methodprotectedconstructMainFilter(  $finalTypes ) : \Elastica_Filter_Or

This function constructs and returns main filter for elasticsearch query.

Parameters
Name Type Description
$finalTypes
Returns
Type Description
\Elastica_Filter_Or
methodprotectedconstructModuleLevelFilter(  $module ) : \Elastica_Filter_And

This function constructs and returns module level filter for elasticsearch query.

Parameters
Name Type Description
$module
Returns
Type Description
\Elastica_Filter_And
methodprotectedconstructTeamFilter( ) : \Elastica_Filter_Or

This function constructs and returns team filter for elasticsearch query.

Returns
Type Description
\Elastica_Filter_Or
methodpubliccreateIndex( boolean $recreate = false ) : void

Create the index and mapping.

Parameters
Name Type Description
$recreate boolean

OPTIONAL Deletes index first if already exists (default = false)

methodpubliccreateIndexDocument( \SugarBean $bean,  $searchFields = null ) : \Elastica_Document | null

Parameters
Name Type Description
$bean \SugarBean
$searchFields
Returns
Type Description
\Elastica_Document | null
methodpublicdelete(  $bean ) : void

(non-PHPdoc)

Parameters
Name Type Description
$bean
Details
See
\SugarSearchEngineInterface::delete()  
methodprotecteddisableFTS( ) : void
inherited

Disable FTS and write to config.

Inherited from: \SugarSearchEngineAbstractBase::disableFTS()
methodpublicgetClient( ) : \Elastica_Client

Get Elastica client

Returns
Type Description
\Elastica_Client
methodpublicgetIndexName( ) : string

Get the name of the index

Returns
Type Description
string
methodprotectedgetIndexType(  $bean ) : string

Return the 'type' for the index. By using the bean type we can specify mappings on a per bean basis if we need to in the future.

Parameters
Name Type Description
$bean
Returns
Type Description
string
methodprotectedgetOwnerField( \SugarBean $bean ) : String

Parameters
Name Type Description
$bean \SugarBean
Returns
Type Description
String owner, or null if no owner found
methodprotectedgetOwnerTermFilter( ) : \Elastica_Filter_Term

This function constructs and returns owner term filter for elasticsearch query.

Returns
Type Description
\Elastica_Filter_Term
methodprotectedgetRecordsFromDocs(  $docs ) : array

Given an array of documents, this constructs an array of records that can be saved to FTS queue.

Parameters
Name Type Description
$docs
Returns
Type Description
array
methodprotectedgetSearchFields( Array $options ) : Array

This function returns an array of fields that can be passed to search engine.

Parameters
Name Type Description
$options Array
Returns
Type Description
Array array of fields
methodpublicgetServerStatus( ) : void

Check the server status

methodprotectedgetTypeTermFilter(  $module ) : \Elastica_Filter_Term

This function constructs and returns type term filter for elasticsearch query.

Parameters
Name Type Description
$module
Returns
Type Description
\Elastica_Filter_Term
methodpublicindexBean( \$bean $bean, \$batch $batch = TRUE ) : void

Either index single bean or add the record to be indexed into _documents for later batch indexing, depending on the $batch parameter

Parameters
Name Type Description
$bean \$bean

SugarBean object to be indexed

$batch \$batch

boolean whether to do batch index

methodprotectedindexSingleBean( \SugarBean $bean ) : void

This indexes one single bean to Elastic Search engine

Parameters
Name Type Description
$bean \SugarBean
methodprotectedisModuleFtsEnabled(  $module ) : bool
inherited

Determine if a module is FTS enabled.

Inherited from: \SugarSearchEngineAbstractBase::isModuleFtsEnabled()
Parameters
Name Type Description
$module
Returns
Type Description
bool
methodpublicisSearchEngineDown( ) : Boolean
staticinherited

This function checks config to see if search engine is down.

Inherited from: \SugarSearchEngineAbstractBase::isSearchEngineDown()
Returns
Type Description
Boolean
methodprotectedloader(  $className ) : mixed

This function loads the desired file/class from Elastic directory.

Parameters
Name Type Description
$className
Returns
Type Description
mixed
methodpublicmarkSearchEngineStatus( Boolean $isDown = true ) : void
staticinherited

This function marks config to indicate that search engine is up or down.

Inherited from: \SugarSearchEngineAbstractBase::markSearchEngineStatus()
Parameters
Name Type Description
$isDown Boolean
methodpublicsearch(  $queryString, int $offset = 0, int $limit = 20,  $options = array() ) : null | \SugarSeachEngineElasticResultSet

Parameters
Name Type Description
$queryString
$offset int
$limit int
$options
Returns
Type Description
null | \SugarSeachEngineElasticResultSet
Documentation was generated by DocBlox 0.18.1.