# http://www.gnu.org/copyleft/gpl.html
/**
- * Search engine hook base class for Oracle (ConText).
- * @addtogroup Search
+ * @file
+ * @ingroup Search
*/
+/**
+ * Search engine hook base class for Oracle (ConText).
+ * @ingroup Search
+ */
class SearchOracle extends SearchEngine {
function __construct($db) {
$this->db = $db;
* @private
*/
function queryNamespaces() {
- $namespaces = implode(',', $this->namespaces);
- if ($namespaces == '') {
+ if( is_null($this->namespaces) )
+ return '';
+ if ( !count( $this->namespaces ) ) {
$namespaces = '0';
+ } else {
+ $namespaces = $this->db->makeList( $this->namespaces );
}
return 'AND page_namespace IN (' . $namespaces . ')';
}
'WHERE page_id=si_page AND ' . $match;
}
- /** @todo document */
+ /**
+ * Parse a user input search string, and return an SQL fragment to be used
+ * as part of a WHERE clause
+ */
function parseQuery($filteredText, $fulltext) {
global $wgContLang;
$lc = SearchEngine::legalSearchChars();
}
}
- $searchon = $this->db->strencode(join(',', $q));
+ $searchon = $this->db->addQuotes(join(',', $q));
$field = $this->getIndexField($fulltext);
- return " CONTAINS($field, '$searchon', 1) > 0 ";
+ return " CONTAINS($field, $searchon, 1) > 0 ";
}
/**
'si_title' => $title,
'si_text' => $text
), 'SearchOracle::update' );
+ $dbw->query("CALL ctx_ddl.sync_index('si_text_idx')");
+ $dbw->query("CALL ctx_ddl.sync_index('si_title_idx')");
}
/**
* @param int $id
* @param string $title
*/
- function updateTitle( $id, $title ) {
+ function updateTitle($id, $title) {
$dbw = wfGetDB(DB_MASTER);
$dbw->update('searchindex',
}
}
+/**
+ * @ingroup Search
+ */
class OracleSearchResultSet extends SearchResultSet {
function __construct($resultSet, $terms) {
$this->mResultSet = $resultSet;
function next() {
$row = $this->mResultSet->fetchObject();
- if( $row === false) {
+ if ($row === false)
return false;
- } else {
- return new SearchResult($row);
- }
+ return new SearchResult($row);
}
}
-
-?>