Hi, I am replying my own post as I start to understand this issue :).
It is a relational division problem. Cyril's solution works but it is too complicated (requires a special field to collect ids of multiple tagged items).
My solution for art_tags (or any other joined mapping table) is to use "any words exact" mode together with "having" clause defining dynamically the exact number of searched tags.
Here is the solution.
I'm looking for items having both of selected two tags (IDs 4 and 5).
1) Apply the "any words exact" mode to art_tags field, that adds the list of desired tags
AND t1.tag_id IN ('4','5')
2) Add HAVING clouse with a number of tags defined
HAVING COUNT(t0.id) = 2
It is very simple, however, I didn't find the way how to dynamically add the number of selected tags to the query without Seblod code modifications. So this post is mainly for SEBLOD developers for an insiration :)
For art_tags plugin, I just added a couple of rows to the onCCK_FieldPrepareSearch function
$cnt = count($value); //counts the ammout of selected tags
if ( $isMultiple ) { //existing variable definging if mutliple tags were seleced
$config['query_parts']['having'][] = 'COUNT(t0.id) = '. $cnt; // adds the HAVING clouse to search query
}
This works for me.
It would be nice to be able to to use this approach not only for the art_tags field but also for any other relational content. There is a Seblod field called "search query" that allows appending HAVING clause, but again I didn't find the way how to dynamically pass the number of selected items to the field settings.
Well, that is my contribution to this issue..Michal