class SearchSqlite extends SearchDatabase {
/**
* Whether fulltext search is supported by current schema
- * @return Boolean
+ * @return bool
*/
function fulltextSearchSupported() {
return $this->db->checkForEnabledSearch();
*/
function parseQuery( $filteredText, $fulltext ) {
global $wgContLang;
- $lc = SearchEngine::legalSearchChars(); // Minus format chars
+ $lc = $this->legalSearchChars(); // Minus format chars
$searchon = '';
$this->searchTerms = array();
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
- * @return SqliteSearchResultSet
+ * @param string $term Raw search term
+ * @return SqlSearchResultSet
*/
function searchText( $term ) {
return $this->searchInternal( $term, true );
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
- * @return SqliteSearchResultSet
+ * @param string $term Raw search term
+ * @return SqlSearchResultSet
*/
function searchTitle( $term ) {
return $this->searchInternal( $term, false );
$totalResult->free();
}
- return new SqliteSearchResultSet( $resultSet, $this->searchTerms, $total );
- }
-
- /**
- * Return a partial WHERE clause to exclude redirects, if so set
- * @return String
- */
- function queryRedirect() {
- if ( $this->showRedirects ) {
- return '';
- } else {
- return 'AND page_is_redirect=0';
- }
+ return new SqlSearchResultSet( $resultSet, $this->searchTerms, $total );
}
/**
* Return a partial WHERE clause to limit the search to the given namespaces
- * @return String
+ * @return string
*/
function queryNamespaces() {
if ( is_null( $this->namespaces ) ) {
/**
* Returns a query with limit for number of results set.
- * @param $sql String:
- * @return String
+ * @param string $sql
+ * @return string
*/
function limitResult( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
/**
* Construct the full SQL query to do the search.
* The guts shoulds be constructed in queryMain()
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->limitResult(
$this->queryMain( $filteredTerm, $fulltext ) . ' ' .
- $this->queryRedirect() . ' ' .
$this->queryNamespaces()
);
}
/**
* Picks which field to index on, depending on what type of query.
- * @param $fulltext Boolean
- * @return String
+ * @param bool $fulltext
+ * @return string
*/
function getIndexField( $fulltext ) {
return $fulltext ? 'si_text' : 'si_title';
/**
* Get the base part of the search query.
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function queryMain( $filteredTerm, $fulltext ) {
$match = $this->parseQuery( $filteredTerm, $fulltext );
$searchindex = $this->db->tableName( 'searchindex' );
return "SELECT COUNT(*) AS c " .
"FROM $page,$searchindex " .
- "WHERE page_id=$searchindex.rowid AND $match" .
- $this->queryRedirect() . ' ' .
+ "WHERE page_id=$searchindex.rowid AND $match " .
$this->queryNamespaces();
}
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
if ( !$this->fulltextSearchSupported() ) {
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
if ( !$this->fulltextSearchSupported() ) {
__METHOD__ );
}
}
-
-/**
- * @ingroup Search
- */
-class SqliteSearchResultSet extends SqlSearchResultSet {
- function __construct( $resultSet, $terms, $totalHits = null ) {
- parent::__construct( $resultSet, $terms );
- $this->mTotalHits = $totalHits;
- }
-
- function getTotalHits() {
- return $this->mTotalHits;
- }
-}