class SearchEngine {
var $limit = 10;
var $offset = 0;
+ var $prefix = '';
var $searchTerms = array();
var $namespaces = array( NS_MAIN );
var $showRedirects = false;
return true;
}
+ /**
+ * Transform search term in cases when parts of the query came as different GET params (when supported)
+ * e.g. for prefix queries: search=test&prefix=Main_Page/Archive -> test prefix:Main Page/Archive
+ */
+ function transformSearchTerm( $term ) {
+ return $term;
+ }
+
/**
* If an exact title match can be find, or a very slightly close match,
* return the title. If no match, returns NULL.
# Go to images that exist even if there's no local page.
# There may have been a funny upload, or it may be on a shared
# file repository such as Wikimedia Commons.
- if( $title->getNamespace() == NS_IMAGE ) {
+ if( $title->getNamespace() == NS_FILE ) {
$image = wfFindFile( $title );
if( $image ) {
return $title;
}
public static function legalSearchChars() {
- return "A-Za-z_'0-9\\x80-\\xFF\\-";
+ return "A-Za-z_'.0-9\\x80-\\xFF\\-";
}
/**
}
/**
- * @return string highlighted suggested query, '' if none
+ * @return string HTML highlighted suggested query, '' if none
*/
function getSuggestionSnippet(){
return '';
$this->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
if( !is_null($this->mTitle) ){
$this->mRevision = Revision::newFromTitle( $this->mTitle );
- if( $this->mTitle->getNamespace() === NS_IMAGE )
+ if( $this->mTitle->getNamespace() === NS_FILE )
$this->mImage = wfFindFile( $this->mTitle );
}
}
if($key == 2){
// see if this is an image link
$ns = substr($val[0],2,-1);
- if( $wgContLang->getNsIndex($ns) != NS_IMAGE )
+ if( $wgContLang->getNsIndex($ns) != NS_FILE )
break;
}
global $wgContLang;
$ns = substr( $matches[1], 0, $colon );
$index = $wgContLang->getNsIndex($ns);
- if( $index !== false && ($index == NS_IMAGE || $index == NS_CATEGORY) )
+ if( $index !== false && ($index == NS_FILE || $index == NS_CATEGORY) )
return $matches[0]; // return the whole thing
else
return $matches[2];