SilverStripe Search

DocumentCoreFactory Uses Extensible, Configurable, LoggerTrait

AbstractYes

Class DocumentFactory Factory to create documents to be pushed to Solr

Table of Contents

Properties

$class  : string
$debug  : bool
Set debug mode on or off
$fieldResolver  : FieldResolver
$items  : SS_List
$keyService  : UniqueKeyInterface
$logger  : LoggerInterface
The logger to use

Methods

__construct()  : mixed
DocumentFactory constructor, sets up the field resolver
buildItems()  : array<string|int, mixed>
Note, it can only take one type of class at a time! So make sure you properly loop and set $class
getClass()  : string
getFieldResolver()  : mixed|object|Injector
getItems()  : mixed
getLogger()  : LoggerInterface
Get the logger
isDebug()  : bool
Are we debugging?
setClass()  : void
setDebug()  : DocumentCoreFactory
Set to true if debugging should be enabled
setFieldResolver()  : void
setItems()  : void
setLogger()  : void
Set the logger if needed
addDefaultFields()  : mixed
classEquals()  : bool
Check if a base class is an instance of the expected base group
classIs()  : bool
Determine if the given object is one of the given type
getShortFieldName()  : mixed
getValuesForField()  : array<string|int, mixed>
Use the DataResolver to find the value(s) for a field.
indexGroupMessage()  : void
Show the message about what is being indexed

Properties

$logger

The logger to use

protected LoggerInterface $logger

Methods

__construct()

DocumentFactory constructor, sets up the field resolver

public __construct() : mixed
Tags
throws
NotFoundExceptionInterface

buildItems()

Note, it can only take one type of class at a time! So make sure you properly loop and set $class

public abstract buildItems(array<string|int, mixed> $fields, BaseIndex $index[, mixed $update = null ]) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

Fields to index

$index : BaseIndex

Index to push the documents to

$update : mixed = null
Tags
throws
Exception
Return values
array<string|int, mixed>

Documents to be pushed

getFieldResolver()

public getFieldResolver() : mixed|object|Injector
Return values
mixed|object|Injector

getLogger()

Get the logger

public getLogger() : LoggerInterface
Tags
throws
NotFoundExceptionInterface
Return values
LoggerInterface

setFieldResolver()

public setFieldResolver(mixed|object|Injector $fieldResolver) : void
Parameters
$fieldResolver : mixed|object|Injector

setLogger()

Set the logger if needed

public setLogger(LoggerInterface $logger) : void
Parameters
$logger : LoggerInterface

addDefaultFields()

protected abstract addDefaultFields(mixed $doc, mixed $item) : mixed
Parameters
$doc : mixed
$item : mixed

classEquals()

Check if a base class is an instance of the expected base group

protected classEquals(string|DataObject $class, string $base) : bool
Parameters
$class : string|DataObject

Class to compare

$base : string

Base class

Return values
bool

classIs()

Determine if the given object is one of the given type

protected classIs(string|DataObject $class, array<string|int, mixed>|string $base) : bool
Parameters
$class : string|DataObject

Class to compare

$base : array<string|int, mixed>|string

Class or list of base classes

Return values
bool

getShortFieldName()

protected getShortFieldName(mixed $name) : mixed
Parameters
$name : mixed

getValuesForField()

Use the DataResolver to find the value(s) for a field.

protected getValuesForField(DataObject $object, array<string|int, mixed> $options) : array<string|int, mixed>

Returns an array of values, and if it's multiple, it becomes a long array

Parameters
$object : DataObject

Object to resolve

$options : array<string|int, mixed>

Customised options

Return values
array<string|int, mixed>

indexGroupMessage()

Show the message about what is being indexed

protected indexGroupMessage(CoreIndex $index) : void
Parameters
$index : CoreIndex
Tags
throws
NotFoundExceptionInterface

        
On this page

Search results