class ElasticSearchAdapter implements SearchAdapterInterface

Elastic Search Adapter Uses an Elastic Search Server for indexing and search operations in XELOS

Traits

Properties

SearchController $mod

Methods

_create_index()

Create Index Structure

addToIndex(SearchIndexRecord $searchIndexRecord)

No description

cleanIndex()

No description

array
getAttachmentFileExtensions(SearchIndexRecord $searchIndexRecord)

Returns all found file extensions of all attachments of SearchIndexRecord.

string
getAttachmentFulltextContent(SearchIndexRecord $searchIndexRecord)

Returns the fulltext content of all attachments of SearchIndexRecord.

string
getAttachmentsHash(SearchIndexRecord $searchIndexRecord)

Returns a combined hash string of all file contents of the attachments of SearchIndexRecord.

Client
getElasticSearchClient()

Returns a connected Elastic Search Client Object

array
getFromIndex(DocumentIndex $DocumentIndex)

No description

array
getIndexInfo()

No description

array
getIndexSchemaStatus()

Returns true if the index schema is uptodate, false if not.

getSearchUpdateDSL(SearchUpdateRecord $searchUpdateRecord)

No description

removeFromIndex(DocumentIndex $DocumentIndex)

No description

search(array $query, array $options = [])

No description

setMod($mod)

Used during Module Transition to allow a partial move to new Adapter Design

updateDocumentsByCallback(array $documentIds, callable $callback, $requiredFields = ['_id', 'meta_data'])

Mass Update to update a few search index attributes for many documents at once This command will not create new Index entries but only update existing ones

Details

at line 462
_create_index()

Create Index Structure

at line 530
string|null _reindex($oldIndex, $newIndex)

Parameters

$oldIndex
$newIndex

Return Value

string|null

TASK ID

at line 61
addToIndex(SearchIndexRecord $searchIndexRecord)

No description

Parameters

SearchIndexRecord $searchIndexRecord

at line 362
cleanIndex()

No description

Exceptions

NoNodesAvailableException

in AttachmentTrait at line 47
protected array getAttachmentFileExtensions(SearchIndexRecord $searchIndexRecord)

Returns all found file extensions of all attachments of SearchIndexRecord.

Returns empty array if there are no attachments.

Parameters

SearchIndexRecord $searchIndexRecord

Return Value

array

in AttachmentTrait at line 18
protected string getAttachmentFulltextContent(SearchIndexRecord $searchIndexRecord)

Returns the fulltext content of all attachments of SearchIndexRecord.

Returns empty string if there are no attachments.

Parameters

SearchIndexRecord $searchIndexRecord

Return Value

string

in AttachmentTrait at line 73
protected string getAttachmentsHash(SearchIndexRecord $searchIndexRecord)

Returns a combined hash string of all file contents of the attachments of SearchIndexRecord.

Returns empty string if there are no attachments.

Parameters

SearchIndexRecord $searchIndexRecord

Return Value

string

at line 382
Client getElasticSearchClient()

Returns a connected Elastic Search Client Object

Make private as soon as old elastic search document has been migrated

Return Value

Client

Exceptions

NoNodesAvailableException

at line 188
array getFromIndex(DocumentIndex $DocumentIndex)

No description

Parameters

DocumentIndex $DocumentIndex

Return Value

array

= [ '_index'=>'xelos-v0001', '_type'=>'document', 'found'=>true, '_source'=>[ 'document_index_id'=>int, 'title'=>string, 'last_index_update'=>'2019-12-13T13:12:12' ]]

Exceptions

NoNodesAvailableException

at line 231
array getIndexInfo()

No description

Return Value

array

Array contains information with keys: document_count, instance_list, index_size

at line 573
array getIndexSchemaStatus()

Returns true if the index schema is uptodate, false if not.

Return Value

array

= ['errorState'=>true|false,'message' => string 'message']

at line 814
getSearchUpdateDSL(SearchUpdateRecord $searchUpdateRecord)

No description

Parameters

SearchUpdateRecord $searchUpdateRecord

at line 150
removeFromIndex(DocumentIndex $DocumentIndex)

No description

Parameters

DocumentIndex $DocumentIndex

Exceptions

NoNodesAvailableException

No description

Parameters

array $query
array $options

at line 224
setMod($mod)

Used during Module Transition to allow a partial move to new Adapter Design

Parameters

$mod

SearchController

updateDocumentsByCallback(array $documentIds, callable $callback, $requiredFields = ['_id', 'meta_data'])

Mass Update to update a few search index attributes for many documents at once This command will not create new Index entries but only update existing ones

Parameters

array $documentIds

List of document ids which shall be processed / updated

callable $callback

Function to be called for each document entry. Retrieves the requiredFields + ES document infos as an $hit array parameter

$requiredFields