class FluentMySQLSearch implements FluentSearchAdapter (View source)

Provides rewrite of fluent searches for MySQLDatabase

Warning: This class is extremely fragile, and sensitive to changes in {\MySQLDatabase::searchEngine} behaviour

Properties

Methods

protected
string|bool
getSearchFilter(SQLQuery $query)

Determine the where fragment containing a fulltext search condition

protected
string
getClass(SQLQuery $query)

Determine the class this query is searching against

protected
getSearchParameters(string $class, string $searchfilter, string $keywords, string $keywordsHTML, bool $booleanMode)

Extract keywords (both SQL and HTML encoded keywords) and boolean mode flag from the query

public
augmentSearch(SQLQuery $query, DataQuery $dataQuery = null)

Detect and rewrite any full text search in this query

public
augmentSelect(string $class, array $translatedColumns, SQLQuery $query, string $keywords, string $keywordsHTML)

Rewrites the SELECT fragment of a query.

public
augmentFilter(string $class, array $translatedColumns, SQLQuery $query, string $keywords, string $keywordsHTML, $booleanMode)

Rewrites the WHERE fragment of a query

Details

protected string|bool getSearchFilter(SQLQuery $query)

Determine the where fragment containing a fulltext search condition

Parameters

SQLQuery $query

Return Value

string|bool

Returns the condition with a fulltext condition, or false if not found

protected string getClass(SQLQuery $query)

Determine the class this query is searching against

Parameters

SQLQuery $query

Return Value

string

protected getSearchParameters(string $class, string $searchfilter, string $keywords, string $keywordsHTML, bool $booleanMode)

Extract keywords (both SQL and HTML encoded keywords) and boolean mode flag from the query

Parameters

string $class

Object to query

string $searchfilter
string $keywords

SQL escaped keywords

string $keywordsHTML

HTML escaped keywords

bool $booleanMode

True if boolean mode

augmentSearch(SQLQuery $query, DataQuery $dataQuery = null)

Detect and rewrite any full text search in this query

Parameters

SQLQuery $query
DataQuery $dataQuery

augmentSelect(string $class, array $translatedColumns, SQLQuery $query, string $keywords, string $keywordsHTML)

Rewrites the SELECT fragment of a query.

This is done in two stages:

  • Augment queried columns
  • Augment relevance column containing the MATCH

Parameters

string $class
array $translatedColumns

Translated columns

SQLQuery $query
string $keywords

SQL escaped keywords

string $keywordsHTML

HTML escaped keywords

augmentFilter(string $class, array $translatedColumns, SQLQuery $query, string $keywords, string $keywordsHTML, $booleanMode)

Rewrites the WHERE fragment of a query

Parameters

string $class
array $translatedColumns

Translated columns

SQLQuery $query
string $keywords

SQL escaped keywords

string $keywordsHTML

HTML escaped keywords

$booleanMode