SilverStripe solr Search

GetterSetterTrait

Trait GetterSetterTrait for getting and setting data

Getters and setters shared between the Index and Query

Table of Contents

Properties

$boostedFields  : array<string|int, mixed>
Sets boosting at _index_ time or _query_ time. Depending on the usage of this trait [ 'FieldName' => 2, ]
$class  : array<string|int, mixed>
$facetFields  : array<string|int, mixed>
Format: SiteTree::class => [ 'BaseClass' => SiteTree::class, 'Field' => 'ChannelID', 'Title' => 'Channel' ], Object::class => [ 'BaseClass' => Object::class, 'Field' => 'Relation.ID', 'Title' => 'Relation' ],

Methods

addBoostedField()  : $this
Add a boosted field to be boosted at query time
addClass()  : $this
Add a class to index or query $options is not used anymore, added for backward compatibility
getBoostedFields()  : array<string|int, mixed>
Get the boosted fields
getClasses()  : array<string|int, mixed>
Get classes
getFacetFields()  : array<string|int, mixed>
Get the facet fields
setBoostedFields()  : $this
Boosted fields are used at index time, not at query time
setClasses()  : $this
Set the classes
setFacetFields()  : $this
Set the facet fields

Properties

$boostedFields

Sets boosting at _index_ time or _query_ time. Depending on the usage of this trait [ 'FieldName' => 2, ]

protected array<string|int, mixed> $boostedFields = []

$facetFields

Format: SiteTree::class => [ 'BaseClass' => SiteTree::class, 'Field' => 'ChannelID', 'Title' => 'Channel' ], Object::class => [ 'BaseClass' => Object::class, 'Field' => 'Relation.ID', 'Title' => 'Relation' ],

protected array<string|int, mixed> $facetFields = []

The facets will be applied as a single "AND" query. e.g. SiteTree_ChannelID:1 with Object_Relation_ID:5 will not be found, if the facet filter requires the SiteTree_ChannelID to be 1 AND Object_Relation_ID to be 3 or 6

Methods

addBoostedField()

Add a boosted field to be boosted at query time

public addBoostedField(string $field[, array<string|int, mixed>|int $options = [] ][, int|null $boost = null ]) : $this

This method is out of place in a way, but it's a shared method between Index and Query, thus needs to be here.

Parameters
$field : string
$options : array<string|int, mixed>|int = []
$boost : int|null = null
Return values
$this

addClass()

Add a class to index or query $options is not used anymore, added for backward compatibility

public addClass( $class[, array<string|int, mixed> $options = [] ]) : $this
Parameters
$class :
$options : array<string|int, mixed> = []

unused

Return values
$this

getBoostedFields()

Get the boosted fields

public getBoostedFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

getClasses()

Get classes

public getClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFacetFields()

Get the facet fields

public getFacetFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

setBoostedFields()

Boosted fields are used at index time, not at query time

public setBoostedFields(array<string|int, mixed> $boostedFields) : $this
Parameters
$boostedFields : array<string|int, mixed>
Return values
$this

setClasses()

Set the classes

public setClasses(array<string|int, mixed> $class) : $this
Parameters
$class : array<string|int, mixed>
Return values
$this

setFacetFields()

Set the facet fields

public setFacetFields(array<string|int, mixed> $facetFields) : $this
Parameters
$facetFields : array<string|int, mixed>
Return values
$this

        
On this page

Search results