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 | $singleton | ||
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 97
static CRM_Utils_QueryFormatter
singleton(bool $fresh = FALSE)
at line 115
__construct(string $mode)
at line 122
setMode(mixed $mode)
at line 129
mixed
getMode()
at line 140
string
format(string $text, string $language)
at line 181
string
formatSql(string $table, array|string $columns, string $queryText)
Create a SQL WHERE expression for matching against a list of text columns.
at line 237
protected mixed
_formatFts(string $text, $mode)
Format Fts.
at line 288
protected mixed
_formatFtsBool(string $text, $mode)
Format FTS.
at line 361
protected mixed
_formatLike($text, $mode)
Format like.
at line 401
protected string
mapWords(string $text, string $template, bool $quotes = FALSE)
at line 414
protected array
parseWords($text, $quotes)
at line 443
protected mixed
dedupeWildcards($text, $wildcard)
at line 460
static array
getModes()
Get modes.
at line 475
static array
getLanguages()
Get languages.