Sunday 24 September 2006 12:00:31 pm
Hi Luc
Looks like the $node.data_map.keywords.content.related_objects and $node.data_map.keywords.content.related_nodes have nothing to do with keyword relations, but are only concerned with explicit relations through the relation or relations attribute type.
This is definitely not the case for me, the nodes/objects in my example did not have any other relations at all so the relation was only created by the shared keyword. The part in your SQL statement that caused problems is usually related to permission and owner checking so you might want to try whether it makes any difference if you are logged in as admin or not. Also make sure (at least for testing) that the objects that should be related via keywords do not have different access permissions and are in the same section. Actually I just realised that I do not know the version of EZ you use. If it is an older version you might want to test your setup on the newest version - maybe the problem was fixed meanwhile. In case it helps find below the sql output I get when I do the following:
{def $node93 = fetch('content', 'node', hash('node_id', 93))}
{def $dataMap = $node93.data_map}
{debug-timing-point id="foobar"}
{$dataMap.keywords.content.related_nodes}
{/debug-timing-point}
debug-timing-point START: foobar
Notice: eZMySQLDB::query(1 rows, 2.846 ms) query number per page:4 Sep 24 2006 19:59:17
SELECT ezkeyword.keyword FROM ezkeyword_attribute_link, ezkeyword
WHERE ezkeyword_attribute_link.keyword_id=ezkeyword.id AND
ezkeyword_attribute_link.objectattribute_id='352'
Notice: eZMySQLDB::query(1 rows, 1.366 ms) query number per page:5 Sep 24 2006 19:59:17
SELECT * FROM ezkeyword_attribute_link
WHERE objectattribute_id='352'
Notice: eZMySQLDB::query(1 rows, 1.969 ms) query number per page:6 Sep 24 2006 19:59:17
SELECT DISTINCT ezcontentobject_attribute.contentobject_id FROM ezkeyword_attribute_link, ezcontentobject_attribute
WHERE keyword_id IN ( 28 ) AND
ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id
AND objectattribute_id <> '352'
Notice: eZMySQLDB::query(1 rows, 1.967 ms) query number per page:7 Sep 24 2006 19:59:17
SELECT ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.name as class_name
FROM ezcontentobject_tree,
ezcontentobject,
ezcontentclass
WHERE ezcontentobject_tree.contentobject_id in ( 92 ) AND
ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id AND
ezcontentobject_tree.contentobject_id=ezcontentobject.id AND
ezcontentclass.version=0 AND
ezcontentclass.id = ezcontentobject.contentclass_id
Timing: Sep 24 2006 19:59:17
debug-timing-point END: foobar
Don't forget that for the related_nodes to work, the objects must have the same class. Good luck Claudia
|