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

Michael J Rubinsky mrubinsk at horde.org
Wed Aug 17 17:46:07 UTC 2011


Quoting roman stachura <roman at stachura.ch>:

> Am 16.08.2011 21:49, schrieb Michael J Rubinsky:
>>
>> [...]
>> I don't have the code in front of me at the moment, so going from  
>> memory here. First, to answer your question:
>>
>> "FROM ($inner) tagged1" is a sql subquery with a table alias. It  
>> allows the subquery to act as a table with a 'object_id' column.  
>> So, e.g., later in the query we join on "tagged1.object_id =  
>> tagged2.object_id" the tagged1 table is actually the subquery  
>> results presented as a table.
>>
>> If I'm reading the code correctly, the idea of this code is to  
>> return tags that are present on objects where those objects are  
>> also tagged with $args['tagId']. The radius determines the max  
>> number of other objects to look at. For example: I have an object  
>> tagged with 'foo' and 'bar', and another object tagged with 'foo'.  
>> If I run this query with the tag_id for 'foo', it will return  
>> 'bar'. At least that's the idea ;)
>
> For this behaviour we need another WHERE clause:
>
> WHERE tag_id != XXX
>
> or we get as result 'foo' and 'bar' instead of 'bar'.

Yup, makes sense.

> I am not sure how good the idea is, to limit the inner Query.
> Performance concerns?

Not sure about performance implications of the limit, but this is  
necessary to enforce the radius. Unless you have some other  
suggestion? Additionally, I'm not sure if the intention was to use the  
same value for radius and limit, as it is currently implemented. I see  
those as two discrete settings. Will look into this as I write new  
tests for that method.

Thanks for the feedback.

-- 
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org



More information about the dev mailing list