Extension to ezpublish subtree fetching methods.

Author Message

Sergiy Pushchin

Friday 26 December 2008 5:26:23 am

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? :)
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.

Heath

Friday 26 December 2008 12: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

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 04:54:01
Script start
Timing: Jan 18 2025 04:54:01
Module start 'layout'
Timing: Jan 18 2025 04:54:01
Module start 'content'
Timing: Jan 18 2025 04:54:02
Module end 'content'
Timing: Jan 18 2025 04:54:02
Script end

Main resources:

Total runtime0.4820 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 589.4922152.6406
Module start 'layout' 0.00610.0033 742.132839.4766
Module start 'content' 0.00940.4711 781.6094540.0938
Module end 'content' 0.48050.0014 1,321.703112.1250
Script end 0.4820  1,333.8281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.7287160.0002
Check MTime0.00150.3019160.0001
Mysql Total
Database connection0.00070.141710.0007
Mysqli_queries0.422687.6769540.0078
Looping result0.00100.2104520.0000
Template Total0.448393.020.2242
Template load0.00190.397920.0010
Template processing0.446492.606920.2232
Template load and register function0.00020.045710.0002
states
state_id_array0.00090.178010.0009
state_identifier_array0.00220.466020.0011
Override
Cache load0.00170.3457230.0001
Sytem overhead
Fetch class attribute can translate value0.00170.343220.0008
Fetch class attribute name0.00130.265340.0003
XML
Image XML parsing0.00771.604420.0039
class_abstraction
Instantiating content class attribute0.00000.002140.0000
General
dbfile0.00741.5385230.0003
String conversion0.00000.002440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs