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

This commit is contained in:
Ingo Schommer 2011-09-15 16:02:23 +02:00
parent 00b81bbdd4
commit 4b933d7e73

View File

@ -1327,6 +1327,13 @@ class MSSQLDatabase extends SS_Database {
$where = null;
if(strpos($tableName, 'SiteTree') === 0) {
$where = array("\"$tableName\".\"ShowInSearch\"!=0");
} elseif(strpos($tableName, 'File') === 0) {
// File.ShowInSearch was added later, keep the database driver backwards compatible
// by checking for its existence first
$fields = $this->fieldList($tableName);
if(array_key_exists('ShowInSearch', $fields)) {
$where = array("\"$tableName\".\"ShowInSearch\"!=0");
}
}
$queries[$tableName] = singleton($tableName)->extendedSQL($where);