Skip to content

Commit

Permalink
updates to tag filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
abrenoch committed Sep 21, 2023
1 parent ca5d6ab commit a366ba9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/GraphQL/Resolver/QueryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,21 @@ static function ($fullpath) use ($db) {
return $db->quote($tag);
}, $args['tags'])));

$conditionParts[] = "o_id IN (
$field = "name";
if (isset($args['useTagIdPath']) && $args['useTagIdPath']) {
$field = "idPath";
}

$statement = "o_id IN (
SELECT cId FROM tags_assignment INNER JOIN tags ON tags.id = tags_assignment.tagid
WHERE
ctype = 'object' AND LOWER(tags.name) IN (" . $tags . '))';
ctype = 'object' AND LOWER(tags." . $field . ") IN (" . $tags . ')';

if (isset($args['hasAllTags']) && $args['hasAllTags']) {
$statement .= " GROUP BY cId HAVING COUNT(DISTINCT tags." . $field . ") = " . count($args['tags']);
}

$conditionParts[] = $statement . ")";
}

// paging
Expand Down

0 comments on commit a366ba9

Please sign in to comment.