From 1b36c75f0a7fa5cf8a33db9706312b81928dada1 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 15 Sep 2011 16:03:03 +0200 Subject: [PATCH] ENHANCEMENT Optionally filtering by new File.ShowInSearch flag in SQLite3Database->searcnEngine() --- code/SQLite3Database.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index 12bc842..8d3f8ab 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -871,7 +871,13 @@ class SQLite3Database extends SS_Database { } // Always ensure that only pages with ShowInSearch = 1 can be searched - $extraFilters['SiteTree'] .= " AND ShowInSearch <> 0"; + $extraFilters['SiteTree'] .= ' AND ShowInSearch <> 0'; + // File.ShowInSearch was added later, keep the database driver backwards compatible + // by checking for its existence first + $fields = $this->fieldList('File'); + if(array_key_exists('ShowInSearch', $fields)) { + $extraFilters['File'] .= " AND ShowInSearch <> 0"; + } $limit = $start . ", " . (int) $pageLength;