Silverstripe 3.7站点搜索-查询失败:错误:语法错误 Silverstripe版本3.7.6 数据库:Postgres 12使用1.2.1版 PHP版本:7.4.16

Silverstripe 3.7站点搜索-查询失败:错误:语法错误 Silverstripe版本3.7.6 数据库:Postgres 12使用1.2.1版 PHP版本:7.4.16,silverstripe,Silverstripe,我有一个在Silverstripe 3.1.2和上面模块的0.9版上运行的现有站点搜索。它遵循官方的Silverstripe教程,并且在升级过程中自定义代码没有更改。此代码位于名为SearchPage_controller的自定义控制器中,使用“search/$Action/$ID/$Batch”路由到该控制器:“SearchPage_controller” $form是/cms/code/search/SearchForm的实例,$form->getResults随后调用postgresqld

我有一个在Silverstripe 3.1.2和上面模块的0.9版上运行的现有站点搜索。它遵循官方的Silverstripe教程,并且在升级过程中自定义代码没有更改。此代码位于名为SearchPage_controller的自定义控制器中,使用“search/$Action/$ID/$Batch”路由到该控制器:“SearchPage_controller”

$form是/cms/code/search/SearchForm的实例,$form->getResults随后调用postgresqldatabase->searchEngine。错误源于该方法中的此行:

// Get the total items in this search
$totalItemsQuery = "SELECT COUNT(*) AS totalitems FROM (" . implode(" UNION ", $tables) . ") AS q1";
$totalCount = DB::query($totalItemsQuery);
当我运行搜索时,在准备好的语句附近出现以下错误

[警告]pg_查询:查询失败:错误:第3行或附近出现语法错误:其中ShowInSearch=^

但它似乎实际上可能是由框架引起的,因为即使将Postgres模块回滚到原始的0.9版本,而不使用Silverstripe,它仍然会遇到这个错误。0.9和SS 3.1.2也可以。完整堆栈跟踪:

pg_queryResource id 188,从SELECT中选择COUNT AS totalitems 不同的类名、SiteTree\u Live.ID、ParentID、Title、, URL段,内容,上次编辑,已创建,文件名为NULL, 名称为NULL,CanViewType, ts_rankSiteTree_Live.ts_搜索字段,q作为来自 SiteTree_Live,to_tsquery'english','fixed'AS q WHERE ShowInSearch=?和SiteTree_Live.ts_SearchFields@@@q 作为q1 PostgreSQLConnector.php:202 PostgreSQLConnector->preparedQuerySELECT COUNT AS totalitems FROM 选择不同的类名、SiteTree\u Live.ID、ParentID、, 标题、URL段、内容、上次编辑、已创建、空为 文件名,名称为NULL,CanViewType, ts_rankSiteTree_Live.ts_搜索字段,q作为来自 SiteTree_Live,to_tsquery'english','fixed'AS q WHERE ShowInSearch=?和SiteTree_Live.ts_SearchFields@@@q 如q1,数组,256 PostgreSQLConnector.php:218 PostgreSQLConnector->querySELECT中的计数为totalitems 不同的类名、SiteTree\u Live.ID、ParentID、Title、, URL段,内容,上次编辑,已创建,文件名为NULL, 名称为NULL,CanViewType, ts_rankSiteTree_Live.ts_搜索字段,q作为来自 SiteTree_Live,to_tsquery'english','fixed'AS q WHERE ShowInSearch=?和SiteTree_Live.ts_SearchFields@@@q 如Q1256 Database.php:118 SS_数据库->{closure}选择计数为 选择不同类名、SiteTree\u Live.ID、, 父ID、标题、URL段、内容、上次编辑、, 已创建,文件名为NULL,名称为NULL,CanViewType, ts_rankSiteTree_Live.ts_搜索字段,q作为来自 SiteTree_Live,to_tsquery'english','fixed'AS q WHERE ShowInSearch=?和SiteTree_Live.ts_SearchFields@@@q 如q1 Database.php:193 SS_数据库->基准查询选择计数 作为“选择不同的类名”中的totalitems, SiteTree_Live.ID、ParentID、标题、URL段、内容、, 上次编辑,已创建,文件名为NULL,名称为NULL, CanViewType,ts_rankSiteTree_Live.ts_搜索字段,q AS 从SiteTree\u Live到\u tsquery'english','fixed'AS的相关性 q其中ShowInSearch=?和SiteTree_Live.ts_搜索字段 @@@qas-q1,Closure-Database.php:119 SS_数据库->查询选择 从SELECT DISTINCT ClassName计算为totalitems, SiteTree_Live.ID、ParentID、标题、URL段、内容、, 上次编辑,已创建,文件名为NULL,名称为NULL, CanViewType,ts_rankSiteTree_Live.ts_搜索字段,q AS 从SiteTree\u Live到\u tsquery'english','fixed'AS的相关性 q其中ShowInSearch=?和SiteTree_Live.ts_搜索字段 @@@qasq1256db.php:276 DB::querySELECT计数为 选择不同类名、SiteTree\u Live.ID、, 父ID、标题、URL段、内容、上次编辑、, 已创建,文件名为NULL,名称为NULL,CanViewType, ts_rankSiteTree_Live.ts_搜索字段,q作为来自 SiteTree_Live,to_tsquery'english','fixed'AS q WHERE ShowInSearch=?和SiteTree_Live.ts_SearchFields@@@q 如q1 PostgreSQLDatabase.php:363 PostgreSQLDatabase->searchEngineArray,'fixed*',0,10,相关性 DESC,,1 SearchForm.php:153
// Get the total items in this search
$totalItemsQuery = "SELECT COUNT(*) AS totalitems FROM (" . implode(" UNION ", $tables) . ") AS q1";
$totalCount = DB::query($totalItemsQuery);