CRM_Utils_QueryFormatter
class CRM_Utils_QueryFormatter
Class CRM_Utils_QueryFormatter
This class is a bad idea. It exists for the unholy reason that a single installation may have up to three query engines (MySQL LIKE, MySQL FTS, Solr) processing the same query-text. It labors* to take the user's search expression and provide similar search semantics in different contexts. It is unknown whether this labor will be fruitful or in vain.
Constants
LANG_SQL_LIKE |
Generate queries using SQL LIKE expressions. |
LANG_SQL_FTS |
Generate queries using MySQL FTS expressions. |
LANG_SQL_FTSBOOL |
Generate queries using MySQL's boolean FTS expressions. |
LANG_SOLR |
Generate queries using Solr expressions. |
MODE_NONE |
Attempt to leave the text as-is. |
MODE_PHRASE |
Attempt to treat the input text as a phrase |
MODE_WILDPHRASE |
Attempt to treat the input text as a phrase with wildcards on each end. |
MODE_WILDWORDS |
Attempt to treat individual word as if it had wildcards at the start and end. |
MODE_WILDWORDS_SUFFIX |
Attempt to treat individual word as if it had a wildcard at the end. |
Properties
static protected CRM_Utils_QueryFormatter|null | $singleton | Singleton object. | |
protected string | $mode |
Methods
No description
No description
No description
No description
No description
Create a SQL WHERE expression for matching against a list of text columns.
Format Fts.
Format FTS.
Format like.
No description
No description
No description
Get modes.
Get languages.
No description
Details
at line 102
static CRM_Utils_QueryFormatter
singleton(bool $fresh = FALSE)
at line 120
__construct(string $mode)
at line 127
setMode(mixed $mode)
at line 134
mixed
getMode()
at line 145
string
format(string $text, string $language)
at line 186
string
formatSql(string $table, array|string $columns, string $queryText)
Create a SQL WHERE expression for matching against a list of text columns.
at line 242
protected mixed
_formatFts(string $text, $mode)
Format Fts.
at line 293
protected mixed
_formatFtsBool(string $text, $mode)
Format FTS.
at line 366
protected mixed
_formatLike($text, $mode)
Format like.
at line 406
protected string
mapWords(string $text, string $template, bool $quotes = FALSE)
at line 419
protected array
parseWords(string $text, bool $quotes)
at line 448
protected mixed
dedupeWildcards($text, $wildcard)
at line 465
static array
getModes()
Get modes.
at line 480
static array
getLanguages()
Get languages.