This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Extensions » Extension to ezpublish subtree...
expandshrink

Extension to ezpublish subtree fetching methods.

Extension to ezpublish subtree fetching methods.

Friday 26 December 2008 2:26:23 pm - 1 reply

Hello all, looking back to the old nice day I recall that we tried to have node storage that allows us to fetch subtree in correct order for unlimited depth. (f. ex. full sitemap or threaded forum.) But we were not able to achieve this. the problem is that when we try to fetch whole subtree and we order by a path_sting we may get incorrect results.
F.ex. we have subtree:

/1/2/10/
/1/2/10/12/
/1/2/20/
/1/2/20/35/
/1/2/100/
/1/2/100/130/

When we sort by a path_string mysql will return it in next order:

/1/2/10/      
/1/2/10/12/
/1/2/100/
/1/2/100/130/
/1/2/20/
/1/2/20/35/

And such order is not correct. But sorting would have been correct if the path_string looked like /1/2/000010/ /1/2/000100/ and so on. Although we still have limitation depth of elements since path_string is var_char(255).
Next thing how to implement this without touching kernel? happy.gif Emoticon
My idea works for mysql > 5.0 with triggers and user defined functions. I have added column called fixed_path varchar(255) to ezcontentobject_tree table and created a triiger that stores there modified path_string. it cuts out the first two elements form path_string and pads next path elements with 0 to 6 digists (so we have limitation 999999 nodes).
Then to enable custom sorting in subtree fetching I created empty extendedattributefilter, and my fetch to fetch full forum thread looks like:

{def  $reply_list=fetch('content','list', hash( parent_node_id, $node.node_id,
                                              limit, $reply_limit,
                                              offset, $reply_offset,
                                              'depth',0,
                                              'extended_attribute_filter',
                                               hash( 'id', 'CorrectSubtree',
                                                     'params', hash(  ) ),
                                              sort_by, array( array( 'fixed_path', true() ) ) ) )}

My question is, can such thing be interesting for others or not?
If so I will wrap all sql and extendedattributefilter code to extension and put it as contribution.

Friday 26 December 2008 9:15:59 pm

Hello Sergiy Pushchin!

I'm certain several people would like to test your solution.

Why not use a project as a place for users to gather? http://projects.ez.no/

Cheers,
Heath

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from