Attribute Filter - or changing to and in SQL

Author Message

Chris Lukenbill

Tuesday 07 November 2006 9:15:08 am

I'm trying to do an attribute filter for a menu that is showing two different classes which both have a "show in menu" attribute on them. However, when I look at the sql that is being generated, it is doing an 'and' when I am specifying 'or'.

The fetch in my template:

    $menuitems=fetch( content, list, hash( 
      parent_node_id, $root_node_id,
      class_filter_type, 'include',
      class_filter_array, ezini('MenuContentSettings','LeftIdentifierList', 'menu.ini'),
      sort_by, $menu_node.sort_array,
      'attribute_filter', array('or',array( 200, '=', '1' ), array( 264, '=', '1' ))))

The portion of SQL code that is generated:

                                       a1.contentobject_id = ezcontentobject.id AND
                                       a1.contentclassattribute_id = 200 AND
                                       a1.version = ezcontentobject_name.content_version AND 
 ( a1.language_id & ezcontentobject.language_mask > 0 AND
     ( (   ezcontentobject.language_mask - ( ezcontentobject.language_mask & a1.language_id ) ) & 1 )
   + ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & a1.language_id ) ) & 2 ) )
   <
     ( a1.language_id & 1 )
   + ( ( a1.language_id & 2 ) )
 ) 
 AND 
                                       a2.contentobject_id = ezcontentobject.id AND
                                       a2.contentclassattribute_id = 264 AND
                                       a2.version = ezcontentobject_name.content_version AND 
 ( a2.language_id & ezcontentobject.language_mask > 0 AND
     ( (   ezcontentobject.language_mask - ( ezcontentobject.language_mask & a2.language_id ) ) & 1 )
   + ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & a2.language_id ) ) & 2 ) )
   <
     ( a2.language_id & 1 )
   + ( ( a2.language_id & 2 ) )
 ) 

any ideas?

Claudia Kosny

Tuesday 07 November 2006 9:24:18 am

Hi Chris

According to the documentation for the content list fetch function this is not possible yet.

...
It is not possible to filter on attributes of different classes, for example it is not possible to filter on both "article/show_comments" and "folder/show_comments" in the same filter.
...

Found here:
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list

So for now the only way I see is to make two separate fetches, one for each class type.
Maybe an extended attribute filter could also help you, but I have never implemented one so I don't know.

Claudia

Chris Lukenbill

Tuesday 07 November 2006 9:36:32 am

Thank you very much for your help. I interpreted that to mean you can't do a filter on just "show_comments" but would instead have to use an or and specify each of them seperately.

I'll see how I can work around it.

Thanks,

Chris

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 19 2025 00:27:14
Script start
Timing: Jan 19 2025 00:27:14
Module start 'layout'
Timing: Jan 19 2025 00:27:14
Module start 'content'
Timing: Jan 19 2025 00:27:14
Module end 'content'
Timing: Jan 19 2025 00:27:14
Script end

Main resources:

Total runtime0.5566 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 588.0391152.6406
Module start 'layout' 0.00560.0036 740.679739.4766
Module start 'content' 0.00920.5452 780.1563475.8516
Module end 'content' 0.55440.0022 1,256.007812.4375
Script end 0.5566  1,268.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.5860160.0002
Check MTime0.00140.2520160.0001
Mysql Total
Database connection0.00080.152110.0008
Mysqli_queries0.510891.7691570.0090
Looping result0.00060.1037550.0000
Template Total0.521893.720.2609
Template load0.00210.368420.0010
Template processing0.519793.366220.2599
Template load and register function0.00020.031610.0002
states
state_id_array0.00160.279910.0016
state_identifier_array0.00170.300720.0008
Override
Cache load0.00170.3033230.0001
Sytem overhead
Fetch class attribute can translate value0.00070.120720.0003
Fetch class attribute name0.00090.168230.0003
XML
Image XML parsing0.00030.046620.0001
class_abstraction
Instantiating content class attribute0.00000.001430.0000
General
dbfile0.00070.1328100.0001
String conversion0.00000.002140.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/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
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs