SilverStripe\FullTextSearch\Search\Indexes\SearchIndex
SearchIndex is the base index class. Each connector will provide a subclass of this that provides search engine specific behavior.
This class is responsible for:
- Taking index calls adding classes and fields, and resolving those to value sources and types
- Determining which records in this index need updating when a DataObject is changed
- Providing utilities to the connector indexes
The connector indexes are responsible for
- Mapping types to index configuration
- Adding and removing items to index
- Parsing and converting SearchQueries into a form the engine will understand, and executing those queries
The user indexes are responsible for
- Specifying which classes and fields this index contains
- Specifying update rules that are not extractable from metadata (because the values come from functions for instance)
Synopsis
class SearchIndex
extends ViewableData
{
- // members
- private static $hide_ancestor;
- private static string $class_delimiter = '_|_';
- protected array $classes = ;
- protected array $fulltextFields = ;
- public array $filterFields = ;
- protected array $sortFields = ;
- protected array $excludedVariantStates = ;
- public array $dependancyList = ;
- public $derivedFields = NULL;
- // methods
- protected string getSourceName()
- public void __construct()
- public void __toString()
- public void fieldData()
- public void addClass()
- public void getClasses()
- public void addFulltextField()
- public void getFulltextFields()
- public void addFilterField()
- public void getFilterFields()
- public void addSortField()
- public void getSortFields()
- public void addAllFulltextFields()
- public MultipleArrayIterator getFieldsIterator()
- public void excludeVariantState()
- public void variantStateExcluded()
- public void buildDependancyList()
- public void getDerivedFields()
- public string getDocumentIDForState()
- public string getDocumentID()
- protected mixed _getFieldValue()
- public static void warn()
- public array getDirtyIDs()
- public abstract void add()
- public abstract void delete()
- public abstract void commit()
- public abstract void init()
Hierarchy
Extends
- SilverStripe\View\ViewableData
Members
private
- $class_delimiter
—
string
Used to separate class name and relation name in the sources array this string must not be present in class name - $hide_ancestor
—
string
Allows this index to hide a parent index. Specifies the name of a parent index to disable
protected
-
$classes
Public, but should only be altered by variants - $excludedVariantStates
- $fulltextFields
- $sortFields
public
- $dependancyList
- $derivedFields
- $filterFields
Methods
protected
- _getFieldValue() — Given an object and a field definition (as returned by fieldData) get the current value of that field on that object
- getSourceName() — This is used to clean the source name from suffix suffixes are needed to support multiple relations with the same name on different page types
public
- __construct()
- __toString()
- add() — !! These should be implemented by the full text search engine
- addAllFulltextFields() — Add all database-backed text fields as fulltext searchable fields.
- addClass() — Add a DataObject subclass whose instances should be included in this index
- addFilterField() — Add a field that should be filterable
- addFulltextField() — Add a field that should be fulltext searchable
- addSortField() — Add a field that should be sortable
- buildDependancyList()
- commit()
- delete()
- excludeVariantState()
- fieldData() — Examines the classes this index is built on to try and find defined fields in the class hierarchy for those classes.
- getClasses() — Get the classes added by addClass
- getDerivedFields() — Returns an array where each member is all the fields and the classes that are at the end of some specific lookup chain from one of the base classes
- getDirtyIDs() — Given a class, object id, set of stateful ids and a list of changed fields (in a special format), return what statefulids need updating in this index
- getDocumentID() — Get the "document ID" (a database & variant unique id) given some "Base" class and DataObject
- getDocumentIDForState() — Get the "document ID" (a database & variant unique id) given some "Base" class, DataObject ID and state array
- getFieldsIterator() — Returns an interator that will let you interate through all added fields, regardless of whether they were added as fulltext, filter or sort fields.
- getFilterFields()
- getFulltextFields()
- getSortFields()
- init() — Called during construction, this is the method that builds the structure.
- variantStateExcluded() — Returns true if some variant state should be ignored
- warn() — Log non-fatal errors