106 return 'AND page_namespace IN (' .
$namespaces .
')';
117 return $this->db->limitResult( $sql, $this->limit, $this->offset );
129 return ' ORDER BY score(1)';
139 private function getQuery( $filteredTerm, $fulltext ) {
142 $this->
queryRanking( $filteredTerm, $fulltext ) .
' ' );
151 return $fulltext ?
'si_text' :
'si_title';
162 $match = $this->
parseQuery( $filteredTerm, $fulltext );
163 $page = $this->db->tableName(
'page' );
164 $searchindex = $this->db->tableName(
'searchindex' );
165 return 'SELECT page_id, page_namespace, page_title ' .
166 "FROM $page,$searchindex " .
167 'WHERE page_id=si_page AND ' .
$match;
179 $this->searchTerms = [];
181 # @todo FIXME: This doesn't handle parenthetical expressions.
184 if (
preg_match_all(
'/([-+<>~]?)(([' . $lc .
']+)(\*?)|"[^"]*")/',
185 $filteredText, $m, PREG_SET_ORDER ) ) {
186 foreach ( $m as $terms ) {
189 $temp_terms = MediaWikiServices::getInstance()->getContentLanguage()->
190 autoConvertToAllVariants( $terms[2] );
193 foreach ( $temp_terms as
$t ) {
194 $searchon .= ( $terms[1] ==
'-' ?
' ~' :
' & ' ) . $this->
escapeTerm( $t );
197 $searchon .= ( $terms[1] ==
'-' ?
' ~' :
' & ' ) . $this->
escapeTerm( $terms[2] );
199 if ( !empty( $terms[3] ) ) {
202 $regexp .=
"[0-9A-Za-z_]+";
207 $this->searchTerms[] =
$regexp;
211 $searchon = $this->db->addQuotes(
ltrim( $searchon,
' &' ) );
213 return " CONTAINS($field, $searchon, 1) > 0 ";
217 $t = MediaWikiServices::getInstance()->getContentLanguage()->normalizeForSearch(
$t );
234 $dbw->replace(
'searchindex',
238 'si_title' => $title,
240 ],
'SearchOracle::update' );
247 $dbw->query(
"CALL ctx_ddl.sync_index(" .
248 $dbw->addQuotes( $dbw->getDBname() .
'.' . $dbw->tableName(
'si_text_idx',
'raw' ) ) .
")" );
249 $dbw->query(
"CALL ctx_ddl.sync_index(" .
250 $dbw->addQuotes( $dbw->getDBname() .
'.' . $dbw->tableName(
'si_title_idx',
'raw' ) ) .
")" );
263 $dbw->update(
'searchindex',
264 [
'si_title' => $title ],
265 [
'si_page' => $id ],
266 'SearchOracle::updateTitle',
271 $searchChars = parent::legalSearchChars(
$type );
272 if (
$type === self::CHARS_ALL ) {
to move a page</td >< td > &*You are moving the page across namespaces
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Base search engine base class for database-backed searches.
filter( $text)
Return a 'cleaned up' search string.
Search engine hook base class for Oracle (ConText).
doSearchTextInDB( $term)
Perform a full text search query and return a result set.
queryNamespaces()
Return a partial WHERE clause to limit the search to the given namespaces.
getIndexField( $fulltext)
Picks which field to index on, depending on what type of query.
update( $id, $title, $text)
Create or update the search index record for the given page.
queryLimit( $sql)
Return a LIMIT clause to limit results on the query.
updateTitle( $id, $title)
Update a search index record's title only.
queryMain( $filteredTerm, $fulltext)
Get the base part of the search query.
queryRanking( $filteredTerm, $fulltext)
Does not do anything for generic search engine subclasses may define this though.
static legalSearchChars( $type=self::CHARS_ALL)
Get chars legal for search NOTE: usage as static is deprecated and preserved only as BC measure.
doSearchTitleInDB( $term)
Perform a title-only search query and return a result set.
parseQuery( $filteredText, $fulltext)
Parse a user input search string, and return an SQL fragment to be used as part of a WHERE clause.
getQuery( $filteredTerm, $fulltext)
Construct the full SQL query to do the search.
This class is used for different SQL-based search engines shipped with MediaWiki.
whereas SearchGetNearMatch runs after $term