SearchMySQL Class Reference
[Search]

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

Inherits SearchEngine.

Inherited by SearchMySQL4.

List of all members.

Public Member Functions

 __construct ($db)
 parseQuery ($filteredText, $fulltext)
 Parse the user's query and transform it into an SQL fragment which will become part of a WHERE clause.
 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.
 queryRedirect ()
 Return a partial WHERE clause to exclude redirects, if so set.
 queryNamespaces ()
 Return a partial WHERE clause to limit the search to the given namespaces.
 queryLimit ()
 Return a LIMIT clause to limit results on the query.
 queryRanking ($filteredTerm, $fulltext)
 Does not do anything for generic search engine subclasses may define this though.
 getQuery ($filteredTerm, $fulltext)
 Construct the full SQL query to do the search.
 getIndexField ($fulltext)
 Picks which field to index on, depending on what type of query.
 queryMain ($filteredTerm, $fulltext)
 Get the base part of the search query.
 getCountQuery ($filteredTerm, $fulltext)
 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.
 normalizeText ($string)
 Converts some characters for MySQL's indexing to grok it correctly, and pads short words to overcome limitations.

Static Public Member Functions

static legalSearchChars ()

Public Attributes

 $strictMatching = true

Static Public Attributes

static $mMinSearchLength

Protected Member Functions

 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.
 minSearchLength ()
 Check MySQL server's ft_min_word_len setting so we know if we need to pad short words.


Detailed Description

Search engine hook for MySQL 4+.

Definition at line 29 of file SearchMySQL.php.


Constructor & Destructor Documentation

SearchMySQL::__construct ( db  ) 

Todo:
document

Definition at line 34 of file SearchMySQL.php.


Member Function Documentation

SearchMySQL::getCountQuery ( filteredTerm,
fulltext 
)

Definition at line 272 of file SearchMySQL.php.

References $page, parseQuery(), queryNamespaces(), and queryRedirect().

Referenced by searchInternal().

SearchMySQL::getIndexField ( fulltext  ) 

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

Parameters:
$fulltext Boolean
Returns:
String

Definition at line 249 of file SearchMySQL.php.

Referenced by parseQuery().

SearchMySQL::getQuery ( filteredTerm,
fulltext 
)

Construct the full SQL query to do the search.

The guts shoulds be constructed in queryMain()

Parameters:
$filteredTerm String
$fulltext Boolean

Definition at line 236 of file SearchMySQL.php.

References queryLimit(), queryMain(), queryNamespaces(), queryRanking(), and queryRedirect().

Referenced by searchInternal().

static SearchMySQL::legalSearchChars (  )  [static]

Reimplemented from SearchEngine.

Definition at line 142 of file SearchMySQL.php.

Referenced by parseQuery().

SearchMySQL::minSearchLength (  )  [protected]

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

..

Returns:
int

Definition at line 381 of file SearchMySQL.php.

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

Referenced by normalizeText().

SearchMySQL::normalizeText ( string  ) 

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

Reimplemented from SearchEngine.

Definition at line 323 of file SearchMySQL.php.

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

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

SearchMySQL::parseQuery ( filteredText,
fulltext 
)

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

Definition at line 42 of file SearchMySQL.php.

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

Referenced by getCountQuery(), and queryMain().

SearchMySQL::queryLimit (  ) 

Return a LIMIT clause to limit results on the query.

Returns:
String

Definition at line 217 of file SearchMySQL.php.

Referenced by getQuery().

SearchMySQL::queryMain ( filteredTerm,
fulltext 
)

Get the base part of the search query.

The actual match syntax will depend on the server version; MySQL 3 and MySQL 4 have different capabilities in their fulltext search indexes.

Parameters:
$filteredTerm String
$fulltext Boolean
Returns:
String

Definition at line 263 of file SearchMySQL.php.

References $page, and parseQuery().

Referenced by getQuery().

SearchMySQL::queryNamespaces (  ) 

Return a partial WHERE clause to limit the search to the given namespaces.

Returns:
String

Definition at line 202 of file SearchMySQL.php.

References SearchEngine::$namespaces.

Referenced by getCountQuery(), and getQuery().

SearchMySQL::queryRanking ( filteredTerm,
fulltext 
)

Does not do anything for generic search engine subclasses may define this though.

Returns:
String

Definition at line 226 of file SearchMySQL.php.

Referenced by getQuery().

SearchMySQL::queryRedirect (  ) 

Return a partial WHERE clause to exclude redirects, if so set.

Returns:
String

Definition at line 190 of file SearchMySQL.php.

Referenced by getCountQuery(), and getQuery().

SearchMySQL::regexTerm ( string,
wildcard 
)

Definition at line 123 of file SearchMySQL.php.

References $wgContLang.

Referenced by parseQuery().

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

SearchMySQL::searchText ( term  ) 

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

Parameters:
$term String: raw search term
Returns:
MySQLSearchResultSet

Reimplemented from SearchEngine.

Definition at line 152 of file SearchMySQL.php.

References searchInternal().

SearchMySQL::searchTitle ( term  ) 

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

Parameters:
$term String: raw search term
Returns:
MySQLSearchResultSet

Reimplemented from SearchEngine.

Definition at line 162 of file SearchMySQL.php.

References searchInternal().

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 371 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:
$id Integer
$title String
$text String

Reimplemented from SearchEngine.

Definition at line 291 of file SearchMySQL.php.

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

SearchMySQL::updateTitle ( id,
title 
)

Update a search index record's title only.

Title should be pre-processed.

Parameters:
$id Integer
$title String

Reimplemented from SearchEngine.

Definition at line 309 of file SearchMySQL.php.

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


Member Data Documentation

SearchMySQL::$mMinSearchLength [static]

Definition at line 31 of file SearchMySQL.php.

SearchMySQL::$strictMatching = true

Definition at line 30 of file SearchMySQL.php.


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

Generated on Sat Apr 30 22:57:48 2011 for MediaWiki by  doxygen 1.5.9