* Currently searches a page's current title (page.page_title) and
* latest revision article text (pagecontent.old_text)
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return PostgresSearchResultSet
*/
function searchTitle( $term ) {
* Transform the user's search string into a better form for tsearch2
* Returns an SQL fragment consisting of quoted text to search for.
*
- * @param $term string
+ * @param string $term
*
* @return string
*/
/**
* Construct the full SQL query to do the search.
- * @param $term String
- * @param $fulltext String
- * @param $colname
+ * @param string $term
+ * @param string $fulltext
+ * @param string $colname
* @return string
*/
function searchQuery( $term, $fulltext, $colname ) {
$searchstring = $this->parseQuery( $term );
## We need a separate query here so gin does not complain about empty searches
- $SQL = "SELECT to_tsquery($searchstring)";
- $res = $this->db->query( $SQL );
+ $sql = "SELECT to_tsquery($searchstring)";
+ $res = $this->db->query( $sql );
if ( !$res ) {
## TODO: Better output (example to catch: one 'two)
die( "Sorry, that was not a valid search string. Please go back and try again" );
"AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery($searchstring)";
}
- ## Redirects
- if ( !$this->showRedirects ) {
- $query .= ' AND page_is_redirect = 0';
- }
-
## Namespaces - defaults to 0
if ( !is_null( $this->namespaces ) ) { // null -> search all
if ( count( $this->namespaces ) < 1 ) {
function update( $pageid, $title, $text ) {
## We don't want to index older revisions
- $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN " .
+ $sql = "UPDATE pagecontent SET textvector = NULL WHERE textvector IS NOT NULL and old_id IN " .
"(SELECT rev_text_id FROM revision WHERE rev_page = " . intval( $pageid ) .
" ORDER BY rev_text_id DESC OFFSET 1)";
- $this->db->query( $SQL );
+ $this->db->query( $sql );
return true;
}
* @ingroup Search
*/
class PostgresSearchResultSet extends SqlSearchResultSet {
- function __construct( $resultSet, $terms ) {
- parent::__construct( $resultSet, $terms );
- }
-
function next() {
- $row = $this->mResultSet->fetchObject();
+ $row = $this->resultSet->fetchObject();
if ( $row === false ) {
return false;
} else {