[dev] need help to understand content tagger getTags by tag-id.

roman stachura roman at stachura.ch
Mon Aug 15 08:12:39 UTC 2011


Hi horde devs.


I was working through the Content_Tagger class.

The class is nicely structured. Well done.

http://git.horde.org/co.php/content/lib/Tagger.php?rt=horde-git&ws=1&r=2644a8bcaadeff77e52a5dfcc80c827b50167e79

I have a question about the function
public function getTags($args){...}

line 280 :


} elseif (isset($args['tagId'])) {

$radius = isset($args['limit']) ? (int)$args['limit'] : 
$this->_defaultRadius;

unset($args['limit'];

$inner = $this->_db->addLimitOffset('
    SELECT object_id
    FROM ' . $this->_t('tagged') . '
    WHERE tag_id = ' . (int)$args['tagId'],
    array('limit' => $radius));

$sql = $this->_db->addLimitOffset('
    SELECT DISTINCT tagged2.tag_id AS tag_id, tag_name
    FROM (' . $inner . ') tagged1
    INNER JOIN ' . $this->_t('tagged') . ' tagged2 ON tagged1.object_id 
= tagged2.object_id
    INNER JOIN ' . $this->_t('tags') . ' t ON tagged2.tag_id = t.tag_id',
    array('limit' => $args['limit']));
} else {...

What is going on here "...FROM ($inner)...?
can someone post it in plain sql?

*   tagId   Only return tags that have been applied to other objects[...]?

Regards roman


More information about the dev mailing list