ENHANCEMENT Optionally filtering by new File.ShowInSearch flag in PostgreSQLDatabase->searcnEngine()

This commit is contained in:
Ingo Schommer 2011-09-15 16:01:53 +02:00
parent 74abdec18b
commit 5e058a151d

View File

@ -1681,10 +1681,16 @@ class PostgreSQLDatabase extends SS_Database {
); );
foreach($result as $row){ foreach($result as $row){
if($row['table_name']=='SiteTree') if($row['table_name']=='SiteTree') {
$showInSearch="AND \"ShowInSearch\"=1 "; $showInSearch="AND \"ShowInSearch\"=1 ";
else } elseif($row['table_name']=='File') {
// File.ShowInSearch was added later, keep the database driver backwards compatible
// by checking for its existence first
$fields = $this->fieldList($row['table_name']);
if(array_key_exists('ShowInSearch', $fields)) $showInSearch="AND \"ShowInSearch\"=1 ";
} else {
$showInSearch=''; $showInSearch='';
}
//public function extendedSQL($filter = "", $sort = "", $limit = "", $join = "", $having = ""){ //public function extendedSQL($filter = "", $sort = "", $limit = "", $join = "", $having = ""){
$query=singleton($row['table_name'])->extendedSql("\"" . $row['table_name'] . "\".\"" . $row['column_name'] . "\" " . $this->default_fts_search_method . ' q ' . $showInSearch, ''); $query=singleton($row['table_name'])->extendedSql("\"" . $row['table_name'] . "\".\"" . $row['column_name'] . "\" " . $this->default_fts_search_method . ' q ' . $showInSearch, '');