Go to the documentation of this file.
34 return $this->db->checkForEnabledSearch();
47 $this->searchTerms =
array();
50 if ( preg_match_all(
'/([-+<>~]?)(([' . $lc .
']+)(\*?)|"[^"]*")/',
51 $filteredText, $m, PREG_SET_ORDER ) ) {
52 foreach ( $m
as $bits ) {
53 @
list( , $modifier,
$term, $nonQuoted, $wildcard ) = $bits;
55 if ( $nonQuoted !=
'' ) {
63 if ( $searchon !==
'' ) {
70 if ( is_array( $convertedVariants ) ) {
71 $variants = array_unique( array_values( $convertedVariants ) );
80 $strippedVariants = array_map(
87 $strippedVariants = array_unique( $strippedVariants );
89 $searchon .= $modifier;
90 if ( count( $strippedVariants ) > 1 ) {
93 foreach ( $strippedVariants
as $stripped ) {
94 if ( $nonQuoted && strpos( $stripped,
' ' ) !==
false ) {
98 $stripped =
'"' . trim( $stripped ) .
'"';
100 $searchon .=
"$quote$stripped$quote$wildcard ";
102 if ( count( $strippedVariants ) > 1 ) {
109 $this->searchTerms[] =
$regexp;
113 wfDebug( __METHOD__ .
": Can't understand search query '{$filteredText}'\n" );
116 $searchon = $this->db->strencode( $searchon );
118 return " $field MATCH '$searchon' ";
124 $regex = preg_quote( $string,
'/' );
130 $regex =
"\b$regex\b";
141 return "\"*" . parent::legalSearchChars();
171 $filteredTerm = $this->
filter( $wgContLang->lc(
$term ) );
172 $resultSet = $this->db->query( $this->
getQuery( $filteredTerm, $fulltext ) );
175 if ( $wgCountTotalSearchHits ) {
176 $totalResult = $this->db->query( $this->
getCountQuery( $filteredTerm, $fulltext ) );
177 $row = $totalResult->fetchObject();
179 $total = intval( $row->c );
181 $totalResult->free();
193 return ''; # search all
200 return 'AND page_namespace IN (' .
$namespaces .
')';
209 return $this->db->limitResult( $sql, $this->limit, $this->offset );
221 $this->
queryMain( $filteredTerm, $fulltext ) .
' ' .
232 return $fulltext ?
'si_text' :
'si_title';
243 $match = $this->
parseQuery( $filteredTerm, $fulltext );
244 $page = $this->db->tableName(
'page' );
245 $searchindex = $this->db->tableName(
'searchindex' );
246 return "SELECT $searchindex.rowid, page_namespace, page_title " .
247 "FROM $page,$searchindex " .
248 "WHERE page_id=$searchindex.rowid AND $match";
252 $match = $this->
parseQuery( $filteredTerm, $fulltext );
253 $page = $this->db->tableName(
'page' );
254 $searchindex = $this->db->tableName(
'searchindex' );
255 return "SELECT COUNT(*) AS c " .
256 "FROM $page,$searchindex " .
257 "WHERE page_id=$searchindex.rowid AND $match " .
277 $dbw->delete(
'searchindex',
array(
'rowid' => $id ), __METHOD__ );
279 $dbw->insert(
'searchindex',
300 $dbw->update(
'searchindex',
302 array(
'rowid' => $id ),
312 parent::__construct( $resultSet, $terms );
313 $this->mTotalHits = $totalHits;
317 return $this->mTotalHits;
__construct( $resultSet, $terms, $totalHits=null)
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
searchTitle( $term)
Perform a title-only search query and return a result set.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
searchText( $term)
Perform a full text search query and return a result set.
limitResult( $sql)
Returns a query with limit for number of results set.
static legalSearchChars()
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
fulltextSearchSupported()
Whether fulltext search is supported by current schema.
queryMain( $filteredTerm, $fulltext)
Get the base part of the search query.
Base search engine base class for database-backed searches.
to move a page</td >< td > &*You are moving the page across namespaces
regexTerm( $string, $wildcard)
getTotalHits()
Some search modes return a total hit count for the query in the entire article database.
getCountQuery( $filteredTerm, $fulltext)
queryNamespaces()
Return a partial WHERE clause to limit the search to the given namespaces.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
filter( $text)
Return a 'cleaned up' search string.
when a variable name is used in a it is silently declared as a new masking the global
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
presenting them properly to the user as errors is done by the caller $title
This class is used for different SQL-based search engines shipped with MediaWiki.
getIndexField( $fulltext)
Picks which field to index on, depending on what type of query.
static legalSearchChars()
Search engine hook for SQLite.
getQuery( $filteredTerm, $fulltext)
Construct the full SQL query to do the search.
the value to return A Title object or null whereas SearchGetNearMatch runs after $term
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
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.
parseQuery( $filteredText, $fulltext)
Parse the user's query and transform it into an SQL fragment which will become part of a WHERE clause...
searchInternal( $term, $fulltext)