SilverStripe\Elastica\Searchable
Adds elastic search integration to a data object.
Synopsis
class Searchable
extends DataExtension
{
- // members
- public static integer $index_ctr = 0;
- private static integer $progressInterval = 0;
- public static array $mappings = ;
- protected ElasticaService $service;
- protected array $html_fields = ;
- protected array $relationship_methods = ;
- private static bool $IndexingOff = false;
- protected Result $elastica_result;
- // methods
- public void __construct()
- public string getElasticaType()
- public Result getElasticaResult()
- public void setElasticaResult()
- public array getElasticaFields()
- public Mapping getElasticaMapping()
- public Document getElasticaDocument()
- public void getFieldValuesAsArray()
- public bool showRecordInSearch()
- public void onBeforeWrite()
- public void onBeforePublish()
- public void onAfterWrite()
- public void onAfterPublish()
- protected void doIndexDocument()
- public void onAfterDelete()
- public void onAfterUnpublish()
- protected void doDeleteDocumentIfInSearch()
- protected void doDeleteDocument()
- public array getAllSearchableFields()
- public void requireDefaultRecords()
- public void RenderResult()
- public void getTermVectors()
- public void updateCMSFields()
Hierarchy
Extends
- DataExtension
Members
private
- $IndexingOff
—
SilverStripe\Elastica\bool
If importing a large number of items from a fixtures file, or indeed some other source, then it is quicker to set a flag of value IndexingOff => false. This has the effect of ensuring no indexing happens, a request is normally made per fixture when loading. One can then run the reindexing teask to bulk index in one HTTP POST request to Elasticsearch. - $progressInterval
—
int
Everytime progressInterval divides $index_ctr exactly display progress.
protected
- $elastica_result — \Elastica\Result
- $html_fields
—
array
Array of fields that need HTML parsed. -
$relationship_methods
Store a mapping of relationship name to result type. - $service — SilverStripe\Elastica\ElasticaService
public
- $index_ctr
—
int
Counter used to display progress of indexing. - $mappings
Methods
protected
- doDeleteDocument() — Removes the record from the search index.
- doDeleteDocumentIfInSearch() — Removes the record from the search index if the "ShowInSearch" attribute is set to true.
- doIndexDocument() — Updates the record in the search index.
public
- __construct()
- RenderResult()
- getAllSearchableFields() — Return all of the searchable fields defined in $this->owner::$searchable_fields and all the parent classes.
- getElasticaDocument() — Get an elasticsearch document.
- getElasticaFields() — Gets an array of elastic field definitions.
- getElasticaMapping() — Get the elasticsearch mapping for the current document/type.
- getElasticaResult() — If the owner is part of a search result the raw Elastica search result is returned if set via setElasticaResult.
- getElasticaType() — Get the elasticsearch type name.
- getFieldValuesAsArray()
- getTermVectors()
- onAfterDelete() — Removes the record from the search index (non-SiteTree).
- onAfterPublish() — Updates the record in the search index (SiteTree).
- onAfterUnpublish() — Removes the record from the search index (non-SiteTree).
- onAfterWrite() — Updates the record in the search index (non-SiteTree).
- onBeforePublish() — Delete the record from the search index if ShowInSearch is deactivated (SiteTree).
- onBeforeWrite() — Delete the record from the search index if ShowInSearch is deactivated (non-SiteTree).
- requireDefaultRecords()
- setElasticaResult() — Set the raw Elastica search result.
- showRecordInSearch() — Returns whether to include the document into the search index.
- updateCMSFields()