Heyday\Elastica\Searchable
Adds elastic search integration to a data object.
Synopsis
class Searchable
extends DataExtension
{
- // members
- public static string $published_field = 'SS_Published';
- public static array $mappings = ;
- private static array $exclude_relations = ;
- private ElasticaService $service;
- protected LoggerInterface $logger = NULL;
- private bool $queued = false;
- // methods
- public void setQueued()
- protected bool getUseQueuedJobs()
- public void __construct()
- public array indexedFields()
- public array dependentClasses()
- public string getElasticaType()
- public array inheritedDatabaseFields()
- protected array getElasticaFields()
- public array getSearchableFields()
- protected array getReferenceSearchableFields()
- protected string stripDataTypeParameters()
- protected string|null formatDate()
- protected int|null formatInt()
- protected float|null formatFloat()
- public bool|Mapping getElasticaMapping()
- protected void setPublishedStatus()
- public Document getElasticaDocument()
- public array getSearchableFieldValues()
- public void onAfterWrite()
- public void reIndex()
- public mixed batchIndex()
- public void onBeforeDelete()
- public void onAfterManyManyRelationRemove()
- public void onAfterManyManyRelationAdd()
- protected void updateDependentClasses()
- protected array createAttachment()
- protected array getSearchableFieldsForRelation()
- protected array getSearchableFieldValuesForRelation()
- protected string formatBoolean()
- protected mixed formatValue()
- protected array getExtraFieldParams()
- protected void queueReindex()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Members
private
- $exclude_relations — array
- $queued — Heyday\Elastica\bool
- $service — Heyday\Elastica\ElasticaService
protected
- $logger — Psr\Log\LoggerInterface
public
- $mappings — array
- $published_field
Methods
protected
- createAttachment() — Serialise a file attachment
- formatBoolean()
- formatDate()
- formatFloat() — Coerce strings into floats
- formatInt() — Coerce strings into integers
- formatValue() — Format a scalar value for the index document
- getElasticaFields() — Gets an array of elastic field definitions.
- getExtraFieldParams() — Get extra params for a field from the parent document
- getReferenceSearchableFields() — Get the searchable fields for the relationships of the owner data object Note we currently only go one layer down eg the property of the document can be Relation_RelationField
- getSearchableFieldValuesForRelation() — Get all fields from a relation on a parent object
- getSearchableFieldsForRelation() — Build searchable spec for a given field
- getUseQueuedJobs() — Check if queued jobs for reindexing is enabled
- queueReindex() — Trigger a queuedjob to update this item.
- setPublishedStatus()
- stripDataTypeParameters() — Clean up the data type name
- updateDependentClasses() — Updates the records of all instances of dependent classes.
public
- __construct()
- batchIndex() — Batch update all documents attached to the index for this record
- dependentClasses() — Return an array of dependant class names. These are classes that need to be reindexed when an instance of the extended class is updated or when a relationship to it changes.
- getElasticaDocument() — Assigns value to the fields indexed from getElasticaFields()
- getElasticaMapping()
- getElasticaType()
- getSearchableFieldValues() — Get values for all searchable fields as an array.
- getSearchableFields() — Get the searchable fields for the owner data object
- indexedFields() — Returns an array of fields to be indexed. Additional configuration can be attached to these fields.
- inheritedDatabaseFields() — Replacing the SS3 inheritedDatabaseFields() method
- onAfterManyManyRelationAdd() — Update dependent classes after the extended object has been added to a ManyManyList
- onAfterManyManyRelationRemove() — Update dependent classes after the extended object has been removed from a ManyManyList
- onAfterWrite() — Updates the record in the search index, or removes it as necessary.
- onBeforeDelete() — Removes the record from the search index.
- reIndex() — reIndex related content
- setQueued()