-
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
- Loading branch information
1 parent
a24aa70
commit c2efb2a
Showing
4 changed files
with
90 additions
and
1 deletion.
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
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 ); | ||
} | ||
|
||
?> |
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,34 @@ | ||
<?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 ) | ||
{ | ||
if ( strpos( $queryParams['q'], 'article' ) !== FALSE ) | ||
{ | ||
$queryParams['fq'][]='meta_class_identifier_ms:article'; | ||
//remove the filter value from the query string | ||
$queryParams['q'] = str_ireplace('article', '', $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