mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Fix search when narrowed to private fields only
This commit is contained in:
@@ -86,12 +86,20 @@ class QueryHelper
|
||||
* @param array $sub_query Clause query
|
||||
* @return array Resulting query
|
||||
*/
|
||||
public static function applyBooleanClause(array $query, $type, array $clause)
|
||||
public static function applyBooleanClause($query, $type, array $clause)
|
||||
{
|
||||
if (!in_array($type, ['must', 'should'])) {
|
||||
throw new \InvalidArgumentException(sprintf('Type must be either "must" or "should", "%s" given', $type));
|
||||
}
|
||||
|
||||
if ($query === null) {
|
||||
return $clause;
|
||||
}
|
||||
|
||||
if (!is_array($query)) {
|
||||
throw new \InvalidArgumentException(sprintf('Query must be either an array or null, "%s" given', gettype($query)));
|
||||
}
|
||||
|
||||
if (!isset($query['bool'])) {
|
||||
// Wrap in a boolean query
|
||||
$bool = [];
|
||||
|
Reference in New Issue
Block a user