-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of query plugin mechanism including optional fetch fu…
…nction parameters
- Loading branch information
1 parent
a24aa70
commit b6e6869
Showing
6 changed files
with
107 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* File containing Search Query Plugin Interface | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
* @version //autogentag// | ||
* @package ezfind | ||
*/ | ||
|
||
/** | ||
* Description of ezfQuerySearchPlugin. | ||
* Interface that Query PLugins should implement. | ||
* The plugin code checks for the correct implementation. | ||
* | ||
*/ | ||
interface ezfQuerySearchPlugin | ||
{ | ||
/** | ||
* @var array $queryParams | ||
*/ | ||
public function modify( &$queryParams, $pluginParams = array() ); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
* @version //autogentag// | ||
*/ | ||
|
||
/** | ||
* Description of ezftestqueryplugin | ||
* | ||
* This test plugin simply looks up if the string 'article' is present in the query | ||
* provided by the user and if so, adds a class filter to type article | ||
* | ||
* @author paul | ||
* | ||
*/ | ||
class ezfTestQueryPlugin implements ezfQuerySearchPlugin | ||
{ | ||
|
||
/** | ||
* | ||
* @param mixed $queryParams | ||
*/ | ||
public function modify( &$queryParams, $pluginParams = array() ) | ||
{ | ||
// To test plugin parameters in legacy templates, add to the search hash array: | ||
// 'plugin_parameters', hash( 'TestPlugin', hash( 'ClassIdentifier', 'folder' ) ) | ||
// and add 'folder' as one of the search keywords or any other class identifier that may be fit | ||
|
||
$classIdentifier = isset($pluginParams['TestPlugin']['ClassIdentifier']) ? $pluginParams['TestPlugin']['ClassIdentifier'] : 'article'; | ||
if ( strpos( $queryParams['q'], $classIdentifier ) !== FALSE ) | ||
{ | ||
$queryParams['fq'][]='meta_class_identifier_ms:' . $classIdentifier; | ||
//remove the filter value from the query string | ||
$queryParams['q'] = str_ireplace( $classIdentifier, '', $queryParams['q']) ; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters