Posts

Showing posts with the label eZ Find

Adding negative filters to eZ Find

I've been doing some work with eZ Find recently and have come across an issue that has also troubled others . While eZ Find includes some powerful filtering options there's no support for negative filters. This can easily remedied by adding "NOT" as an allowed Boolean Operator and adding specific handling of NOT to the final query construction to ezfind/classes/ezfezpsolrquerybuilder.php . This small change allows NOT to be used in the same manor as the existing AND and OR operators. An enhancement request has been lodged that includes the following patch. diff --git a/classes/ezfezpsolrquerybuilder.php b/classes/ezfezpsolrquerybuilder.php index 3c997dc..f30813c 100755 --- a/classes/ezfezpsolrquerybuilder.php +++ b/classes/ezfezpsolrquerybuilder.php @@ -852,7 +852,10 @@ class ezfeZPSolrQueryBuilder } } - return implode( " $booleanOperator ", $filterQueryList ); + if ( $booleanOperator == 'NOT' ) + return '...