MediaWiki  REL1_19
SearchMySQL Class Reference

Search engine hook for MySQL 4+. More...

Inheritance diagram for SearchMySQL:
Collaboration diagram for SearchMySQL:

List of all members.

Public Member Functions

 __construct ($db)
 Creates an instance of this class.
 getCountQuery ($filteredTerm, $fulltext)
 getIndexField ($fulltext)
 Picks which field to index on, depending on what type of query.
 getQuery ($filteredTerm, $fulltext)
 Construct the SQL query to do the search.
 normalizeText ($string)
 Converts some characters for MySQL's indexing to grok it correctly, and pads short words to overcome limitations.
 parseQuery ($filteredText, $fulltext)
 Parse the user's query and transform it into an SQL fragment which will become part of a WHERE clause.
 queryMain (&$query, $filteredTerm, $fulltext)
 Get the base part of the search query.
 queryNamespaces (&$query)
 Add namespace conditions.
 regexTerm ($string, $wildcard)
 searchText ($term)
 Perform a full text search query and return a result set.
 searchTitle ($term)
 Perform a title-only search query and return a result set.
 supports ($feature)
 update ($id, $title, $text)
 Create or update the search index record for the given page.
 updateTitle ($id, $title)
 Update a search index record's title only.

Static Public Member Functions

static legalSearchChars ()

Public Attributes

 $strictMatching = true

Static Public Attributes

static $mMinSearchLength

Protected Member Functions

 limitResult (&$query)
 Add limit options.
 minSearchLength ()
 Check MySQL server's ft_min_word_len setting so we know if we need to pad short words...
 queryFeatures (&$query)
 Add special conditions.
 searchInternal ($term, $fulltext)
 stripForSearchCallback ($matches)
 Armor a case-folded UTF-8 string to get through MySQL's fulltext search without being mucked up by funny charset settings or anything else of the sort.

Detailed Description

Search engine hook for MySQL 4+.

Definition at line 31 of file SearchMySQL.php.


Constructor & Destructor Documentation

Creates an instance of this class.

Parameters:
$dbDatabaseMysql: database object

Reimplemented from SearchEngine.

Definition at line 39 of file SearchMySQL.php.

References SearchEngine\$db.


Member Function Documentation

SearchMySQL::getCountQuery ( filteredTerm,
fulltext 
)
Since:
1.18 (changed)

Definition at line 312 of file SearchMySQL.php.

References parseQuery(), queryFeatures(), and queryNamespaces().

Referenced by searchInternal().

Here is the call graph for this function:

Here is the caller graph for this function:

SearchMySQL::getIndexField ( fulltext)

Picks which field to index on, depending on what type of query.

Parameters:
$fulltextBoolean
Returns:
String

Definition at line 286 of file SearchMySQL.php.

Referenced by parseQuery().

Here is the caller graph for this function:

SearchMySQL::getQuery ( filteredTerm,
fulltext 
)

Construct the SQL query to do the search.

The guts shoulds be constructed in queryMain()

Parameters:
$filteredTermString
$fulltextBoolean
Returns:
Array
Since:
1.18 (changed)

Definition at line 264 of file SearchMySQL.php.

References limitResult(), queryFeatures(), queryMain(), and queryNamespaces().

Referenced by searchInternal().

Here is the call graph for this function:

Here is the caller graph for this function:

static SearchMySQL::legalSearchChars ( ) [static]

Reimplemented from SearchEngine.

Definition at line 152 of file SearchMySQL.php.

Referenced by parseQuery().

Here is the caller graph for this function:

SearchMySQL::limitResult ( &$  query) [protected]

Add limit options.

Parameters:
$queryArray
Since:
1.18

Definition at line 251 of file SearchMySQL.php.

Referenced by getQuery().

Here is the caller graph for this function:

Check MySQL server's ft_min_word_len setting so we know if we need to pad short words...

Returns:
int

Definition at line 426 of file SearchMySQL.php.

References $dbr, $mMinSearchLength, $result, and wfGetDB().

Referenced by normalizeText().

Here is the call graph for this function:

Here is the caller graph for this function:

Converts some characters for MySQL's indexing to grok it correctly, and pads short words to overcome limitations.

Reimplemented from SearchEngine.

Definition at line 369 of file SearchMySQL.php.

References $n, $out, $wgContLang, minSearchLength(), wfProfileIn(), and wfProfileOut().

Referenced by parseQuery(), update(), and updateTitle().

Here is the call graph for this function:

Here is the caller graph for this function:

SearchMySQL::parseQuery ( filteredText,
fulltext 
)

Parse the user's query and transform it into an SQL fragment which will become part of a WHERE clause.

Parameters:
$filteredTextstring
$fulltextstring
Returns:
string

Definition at line 52 of file SearchMySQL.php.

References $wgContLang, getIndexField(), legalSearchChars(), normalizeText(), regexTerm(), and wfDebug().

Referenced by getCountQuery(), and queryMain().

Here is the call graph for this function:

Here is the caller graph for this function:

SearchMySQL::queryFeatures ( &$  query) [protected]

Add special conditions.

Parameters:
$queryArray
Since:
1.18

Definition at line 222 of file SearchMySQL.php.

Referenced by getCountQuery(), and getQuery().

Here is the caller graph for this function:

SearchMySQL::queryMain ( &$  query,
filteredTerm,
fulltext 
)

Get the base part of the search query.

Parameters:
&$querySearch query array
$filteredTermString
$fulltextBoolean
Since:
1.18 (changed)

Definition at line 298 of file SearchMySQL.php.

References parseQuery().

Referenced by getQuery().

Here is the call graph for this function:

Here is the caller graph for this function:

Add namespace conditions.

Parameters:
$queryArray
Since:
1.18 (changed)

Definition at line 237 of file SearchMySQL.php.

Referenced by getCountQuery(), and getQuery().

Here is the caller graph for this function:

SearchMySQL::regexTerm ( string,
wildcard 
)

Definition at line 133 of file SearchMySQL.php.

References $wgContLang.

Referenced by parseQuery().

Here is the caller graph for this function:

SearchMySQL::searchInternal ( term,
fulltext 
) [protected]

Definition at line 176 of file SearchMySQL.php.

References $total, $wgCountTotalSearchHits, SearchEngine\filter(), getCountQuery(), and getQuery().

Referenced by searchText(), and searchTitle().

Here is the call graph for this function:

Here is the caller graph for this function:

Perform a full text search query and return a result set.

Parameters:
$termString: raw search term
Returns:
MySQLSearchResultSet

Reimplemented from SearchEngine.

Definition at line 162 of file SearchMySQL.php.

References searchInternal().

Here is the call graph for this function:

Perform a title-only search query and return a result set.

Parameters:
$termString: raw search term
Returns:
MySQLSearchResultSet

Reimplemented from SearchEngine.

Definition at line 172 of file SearchMySQL.php.

References searchInternal().

Here is the call graph for this function:

SearchMySQL::stripForSearchCallback ( matches) [protected]

Armor a case-folded UTF-8 string to get through MySQL's fulltext search without being mucked up by funny charset settings or anything else of the sort.

Definition at line 416 of file SearchMySQL.php.

References $matches.

SearchMySQL::supports ( feature)
Since:
1.18
Parameters:
$featureString
Returns:
Boolean

Reimplemented from SearchEngine.

Definition at line 207 of file SearchMySQL.php.

SearchMySQL::update ( id,
title,
text 
)

Create or update the search index record for the given page.

Title and text should be pre-processed.

Parameters:
$idInteger
$titleString
$textString

Reimplemented from SearchEngine.

Definition at line 337 of file SearchMySQL.php.

References $title, normalizeText(), and wfGetDB().

Here is the call graph for this function:

SearchMySQL::updateTitle ( id,
title 
)

Update a search index record's title only.

Title should be pre-processed.

Parameters:
$idInteger
$titleString

Reimplemented from SearchEngine.

Definition at line 355 of file SearchMySQL.php.

References $title, normalizeText(), and wfGetDB().

Here is the call graph for this function:


Member Data Documentation

SearchMySQL::$mMinSearchLength [static]

Definition at line 33 of file SearchMySQL.php.

Referenced by minSearchLength().

SearchMySQL::$strictMatching = true

Definition at line 32 of file SearchMySQL.php.


The documentation for this class was generated from the following file: