classFullTextSearch
final class FullTextSearch
implements Scalar
uses Snapshot
@visibility public.A full-text search: MATCH (col, …) AGAINST (expr [mode]) (Item_func_match).
The column list may be written with or without parentheses, and a natural language search may state IN NATURAL LANGUAGE MODE; both forms are kept, since they are part of the text MySQL names an unaliased select list expression after. The search string is a bit_expr; before IN BOOLEAN MODE it may not end in a form that would take the IN.
Rule: MYSQL-FULLTEXT-001. Facts: the relevance, a DOUBLE; it is treated as possibly NULL. Every column is resolved in the environment. Terminates: the columns and the search string are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/fulltext-search.html#function_match. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM t WHERE MATCH a, b AGAINST ('x' WITH QUERY EXPANSION)");
[count($query->statement->where->columns), $query->toString()] // => [2, "SELECT a FROM t WHERE MATCH a, b AGAINST ('x' WITH QUERY EXPANSION)"]Properties§
public non-empty-list<ColumnUse> $columnspublic Scalar $againstpublic FullTextMode $mode = FullTextMode::NaturalLanguagepublic OptionalWords $parentheses = OptionalWords::Writtenpublic OptionalWords $stated = OptionalWords::OmittedMethods§
public function __construct(
list<ColumnUse> $columns,
public Scalar $against,
public FullTextMode $mode = FullTextMode::NaturalLanguage,
public OptionalWords $parentheses = OptionalWords::Written,
public OptionalWords $stated = OptionalWords::Omitted,
)Parameters
$columns | list<ColumnUse> | The searched columns in order; at least one |
$against | Scalar | The search string |
$mode | FullTextMode | The search mode |
$parentheses | OptionalWords | Whether the column list is written in parentheses |
$stated | OptionalWords | Whether a natural language search writes IN NATURAL LANGUAGE MODE |
Calls 12
- class-const FullTextMode::NaturalLanguage() line 59
- class-const OptionalWords::Written() line 59
- class-const OptionalWords::Omitted() line 59
- static-call Check::listOf() line 61
- class-const ColumnUse::class() line 61
- new Precedence line 62
- static-call Check::input() line 63
- method-call Precedence::admits() line 63
- class-const Precedence::BIT_EXPR() line 63
- class-const FullTextMode::Boolean() line 64
- method-call Precedence::absorbs() line 65
- class-const Precedence::PREDICATE() line 65
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the columns and the search string; the relevance is a DOUBLE.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 8
- new Operands line 73
- method-call Operands::single() line 75
- method-call Derivation::scalar() line 75
- new ScalarFact line 79
- new Known line 79
- new Floating line 79
- class-const FloatingKind::Double() line 79
- class-const Nullability::Nullable() line 79
public function render(Output $out): voidWrites MATCH, the columns, AGAINST, the search string and the mode.
Parameters
$out | Output |
Test cases 1
Calls 7
- method-call Output::keyword() line 87
- class-const OptionalWords::Written() line 88
- method-call Output::symbol() line 89
- method-call Output::list() line 91
- class-const FullTextMode::NaturalLanguage() line 98
- class-const FullTextMode::QueryExpansion() line 99
- class-const FullTextMode::Boolean() line 100
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.