From 4578b11b456422d969f9d74e23b4db4aedce9241 Mon Sep 17 00:00:00 2001 From: Paul Borgermans Date: Mon, 13 Apr 2015 00:56:54 +0200 Subject: [PATCH] Initial version of query plugin mechanism --- classes/queryplugins/ezfquerysearchplugin.php | 26 +++++++++++++++ classes/queryplugins/ezftestqueryplugin.php | 32 +++++++++++++++++++ search/plugins/ezsolr/ezsolr.php | 25 +++++++++++++++ settings/ezfind.ini | 6 +++- 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 classes/queryplugins/ezfquerysearchplugin.php create mode 100644 classes/queryplugins/ezftestqueryplugin.php diff --git a/classes/queryplugins/ezfquerysearchplugin.php b/classes/queryplugins/ezfquerysearchplugin.php new file mode 100644 index 00000000..89a5d7cc --- /dev/null +++ b/classes/queryplugins/ezfquerysearchplugin.php @@ -0,0 +1,26 @@ + diff --git a/classes/queryplugins/ezftestqueryplugin.php b/classes/queryplugins/ezftestqueryplugin.php new file mode 100644 index 00000000..f183e8d8 --- /dev/null +++ b/classes/queryplugins/ezftestqueryplugin.php @@ -0,0 +1,32 @@ +FindINI->variable('QueryPlugins', 'Search'); + if (!empty($generalSearchPlugins)) + { + foreach ($generalSearchPlugins as $pluginClassString) + { + if (!class_exists($pluginClassString)) + { + eZDebug::writeError("Unable to find the PHP class '$pluginClassString' defined for query time plugins for eZ Find", __METHOD__); + continue; + } + $plugin = new $pluginClassString; + if ($plugin instanceof ezfQuerySearchPlugin) + { + $plugin->modify( $queryParams ); + } + else + { + eZDebug::writeError("Provided plugin '$pluginClassString' is not of the correct type: ezfQuerySearchPlugin", __METHOD__); + continue; + } + } + } + $resultArray = $coreToUse->rawSearch( $queryParams ); eZDebug::accumulatorStop( 'Engine time' ); } diff --git a/settings/ezfind.ini b/settings/ezfind.ini index 8ef3cb06..7bfda0b5 100644 --- a/settings/ezfind.ini +++ b/settings/ezfind.ini @@ -330,4 +330,8 @@ FiltersList[geodist]=eZFindGeoDistExtendedAttributeFilter [QueryBoost] RawBoostQueries[] -#RawBoostQueries[]=meta_class_identifier_ms:folder^10 \ No newline at end of file +#RawBoostQueries[]=meta_class_identifier_ms:folder^10 + +[QueryPlugins] +Search[] +//Search[]=ezfTestQueryPlugin