SilverStripe\Elastica\ElasticaService
A service used to interact with elastic search.
Synopsis
class ElasticaService
{
- // members
- protected array $buffer = ;
- protected bool $buffered = false;
- private Client $client;
- private $indexName;
- private $locale;
- private static array; $site_tree_classes = ;
- public static integer $indexing_request_ctr = 0;
- private array $highlightedFields = ;
- private integer $nDocumentsToIndexForLocale = 0;
- public boolean $test_mode = false;
- // methods
- public void setHighlightedFields()
- public void __construct()
- public void setTestMode()
- public Client getClient()
- public Index getIndex()
- public void setLocale()
- public void getIndexName()
- private void getLocaleIndexName()
- public ResultList search()
- private void addExtractedQueryTermsForMoreLikeThis()
- private void addTypesToSearch()
- private void getHighlightingConfig()
- private void checkForTermsMoreLikeThis()
- protected void ensureIndex()
- protected Mapping ensureMapping()
- public void index()
- public void startBulkIndex()
- public void listIndexes()
- public void endBulkIndex()
- public void remove()
- public void define()
- protected void refreshRecords()
- protected DataList recordsByClassConsiderVersioned()
- protected void refreshClass()
- public void refresh()
- public void reset()
- private void createIndex()
- public IndexSettings getIndexSettingsForCurrentLocale()
- public array getIndexedClasses()
- public int getIndexingRequestCtr()
- public array getTermVectors()
Members
private
- $client — \Elastica\Client
- $highlightedFields
—
array
Array of highlighted fields, e.g. Title, Title.standard. If this is empty then the ShowHighlight field of SearchableField is used to determine which fields to highlight. - $indexName — string
- $locale
—
string
The code of the locale being indexed or searched. - $nDocumentsToIndexForLocale
—
int
The number of documents to index currently for this locale. - $site_tree_classes
—
SilverStripe\Elastica\array;
Mapping of DataObject ClassName and whether it is in the SiteTree or not.
protected
- $buffer — array
- $buffered — SilverStripe\Elastica\bool
public
- $indexing_request_ctr
—
int
Counter used to for testing, records indexing requests. - $test_mode
Methods
private
- addExtractedQueryTermsForMoreLikeThis()
- addTypesToSearch()
- checkForTermsMoreLikeThis()
- createIndex()
- getHighlightingConfig()
- getLocaleIndexName()
protected
- ensureIndex() — Ensure that the index is present.
- ensureMapping() — Ensure that there is a mapping present.
- recordsByClassConsiderVersioned() — Get a List of all records by class. Get the "Live data" If the class has the "Versioned" extension.
- refreshClass() — Refresh the records of a given class within the search index.
- refreshRecords() — Refresh an array of records in the index.
public
- __construct()
- define() — Creates the index and the type mappings.
- endBulkIndex() — Ends the current bulk index operation and indexes the buffered documents.
- getClient()
- getIndex()
- getIndexName()
- getIndexSettingsForCurrentLocale() — Get the index settings for the current locale.
- getIndexedClasses() — Gets the classes which are indexed (i.e. have the extension applied).
- getIndexingRequestCtr() — Get the number of indexing requests made. Used for testing bulk indexing.
- getTermVectors() — Get the term vectors in the index for the provided Searchable is_object.
- index() — Either creates or updates a record in the index.
- listIndexes()
- refresh() — Re-indexes each record in the index.
- remove() — Deletes a record from the index.
- reset() — Reset the current index.
- search() — Performs a search query and returns a result list.
- setHighlightedFields()
- setLocale()
- setTestMode()
- startBulkIndex() — Begins a bulk indexing operation where documents are buffered rather than indexed immediately.