*/
use MediaWiki\MediaWikiServices;
-use Wikimedia\Rdbms\DatabaseSqlite;
/**
* Search engine hook for SQLite
* Whether fulltext search is supported by current schema
* @return bool
*/
- function fulltextSearchSupported() {
- /** @var DatabaseSqlite $dbr */
- $dbr = $this->lb->getConnection( DB_REPLICA );
+ private function fulltextSearchSupported() {
+ $dbr = $this->lb->getMaintenanceConnectionRef( DB_REPLICA );
+ $sql = (string)$dbr->selectField(
+ $dbr->addIdentifierQuotes( 'sqlite_master' ),
+ 'sql',
+ [ 'tbl_name' => $dbr->tableName( 'searchindex', 'raw' ) ],
+ __METHOD__
+ );
- return $dbr->checkForEnabledSearch();
+ return ( stristr( $sql, 'fts' ) !== false );
}
/**
* Perform a full text search query and return a result set.
*
* @param string $term Raw search term
- * @return SqlSearchResultSet
+ * @return SqlSearchResultSet|null
*/
protected function doSearchTextInDB( $term ) {
return $this->searchInternal( $term, true );
* Perform a title-only search query and return a result set.
*
* @param string $term Raw search term
- * @return SqlSearchResultSet
+ * @return SqlSearchResultSet|null
*/
protected function doSearchTitleInDB( $term ) {
return $this->searchInternal( $term, false );
* @param string $title
* @param string $text
*/
- function update( $id, $title, $text ) {
+ public function update( $id, $title, $text ) {
if ( !$this->fulltextSearchSupported() ) {
return;
}
* @param int $id
* @param string $title
*/
- function updateTitle( $id, $title ) {
+ public function updateTitle( $id, $title ) {
if ( !$this->fulltextSearchSupported() ) {
return;
}