class FulltextFilter extends SearchFilter

Filters by full-text matching on the given field.

Full-text indexes are only available with MyISAM tables. The following column types are supported: - Char - Varchar - Text

To enable full-text matching on fields, you also need to add an index to the database table, using the {$indexes} hash in your DataObject subclass:

private static $indexes = [ 'SearchFields' => [ 'type' => 'fulltext', 'columns' => ['Name', 'Title', 'Description'], ];

Traits

A class that can be instantiated or replaced via DI

Methods

static Injectable
create(array $args)

An implementation of the factory method, allows you to create an instance of a class

static Injectable
singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

__construct(string $fullName = null, mixed $value = false, array $modifiers = array())

No description

setModel(string|DataObject $className)

Set the root model class to be selected by this search query.

setValue(string|array $value)

Set the current value(s) to be filtered on.

string|array
getValue()

Accessor for the current value to be filtered on.

setModifiers(array $modifiers)

Set the current modifiers to apply to the filter

array
getSupportedModifiers()

Gets supported modifiers for this filter

array
getModifiers()

Accessor for the current modifiers to apply to the filter.

string
getName()

The original name of the field.

setName(String $name)

No description

string
getFullName()

The full name passed to the constructor, including any (optional) relations in dot notation.

setFullName(String $name)

No description

string
getDbName()

This implementation allows for a list of columns to be passed into MATCH() instead of just one.

string
getDbFormattedValue()

Return the value of the field as processed by the DBField class

applyAggregate(DataQuery $query, string $having)

Given an escaped HAVING clause, add it along with the appropriate GROUP BY clause

apply(DataQuery $query)

Apply filter criteria to a SQL query.

exclude(DataQuery $query)

Exclude filter criteria from a SQL query.

boolean
isEmpty()

Determines if a field has a value, and that the filter should be applied.

Details

in Injectable at line 26
static Injectable create(array $args)

An implementation of the factory method, allows you to create an instance of a class

This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.

This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();

Parameters

array $args

Return Value

Injectable

in Injectable at line 43
static Injectable singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).

Parameters

string $class Optional classname to create, if the called class should not be used

Return Value

Injectable The singleton instance

in SearchFilter at line 88
__construct(string $fullName = null, mixed $value = false, array $modifiers = array())

Parameters

string $fullName Determines the name of the field, as well as the searched database column. Can contain a relation name in dot notation, which will automatically join the necessary tables (e.g. "Comments.Name" to join the "Comments" has-many relationship and search the "Name" column when applying this filter to a SiteTree class).
mixed $value
array $modifiers

in SearchFilter at line 149
setModel(string|DataObject $className)

Set the root model class to be selected by this search query.

Parameters

string|DataObject $className

in SearchFilter at line 159
setValue(string|array $value)

Set the current value(s) to be filtered on.

Parameters

string|array $value

in SearchFilter at line 169
string|array getValue()

Accessor for the current value to be filtered on.

Return Value

string|array

in SearchFilter at line 179
setModifiers(array $modifiers)

Set the current modifiers to apply to the filter

Parameters

array $modifiers

in SearchFilter at line 200
array getSupportedModifiers()

Gets supported modifiers for this filter

Return Value

array

in SearchFilter at line 211
array getModifiers()

Accessor for the current modifiers to apply to the filter.

Return Value

array

in SearchFilter at line 221
string getName()

The original name of the field.

Return Value

string

in SearchFilter at line 229
setName(String $name)

Parameters

String $name

in SearchFilter at line 240
string getFullName()

The full name passed to the constructor, including any (optional) relations in dot notation.

Return Value

string

in SearchFilter at line 248
setFullName(String $name)

Parameters

String $name

at line 66
string getDbName()

This implementation allows for a list of columns to be passed into MATCH() instead of just one.

Return Value

string

Exceptions

Exception

in SearchFilter at line 317
string getDbFormattedValue()

Return the value of the field as processed by the DBField class

Return Value

string

in SearchFilter at line 338
DataQuery applyAggregate(DataQuery $query, string $having)

Given an escaped HAVING clause, add it along with the appropriate GROUP BY clause

Parameters

DataQuery $query
string $having

Return Value

DataQuery

in SearchFilter at line 354
DataQuery apply(DataQuery $query)

Apply filter criteria to a SQL query.

Parameters

DataQuery $query

Return Value

DataQuery

in SearchFilter at line 392
DataQuery exclude(DataQuery $query)

Exclude filter criteria from a SQL query.

Parameters

DataQuery $query

Return Value

DataQuery

at line 49
boolean isEmpty()

Determines if a field has a value, and that the filter should be applied.

Relies on the field being populated with {@link setValue()}

Return Value

boolean