Forums / General / Attribute Filter - or changing to and in SQL

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

eZ debug

Timing: Jan 18 2025 21:10:38
Script start
Timing: Jan 18 2025 21:10:38
Module start 'content'
Timing: Jan 18 2025 21:10:39
Module end 'content'
Timing: Jan 18 2025 21:10:39
Script end

Main resources:

Total runtime1.2479 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 587.8359180.8203
Module start 'content' 0.00691.0350 768.6563480.9453
Module end 'content' 1.04190.2060 1,249.6016333.7891
Script end 1.2479  1,583.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3210210.0002
Check MTime0.00150.1177210.0001
Mysql Total
Database connection0.00100.079410.0010
Mysqli_queries1.178794.45181940.0061
Looping result0.00230.18141920.0000
Template Total1.220997.820.6105
Template load0.00250.203820.0013
Template processing1.218497.631120.6092
Template load and register function0.00020.014210.0002
states
state_id_array0.00070.055910.0007
state_identifier_array0.00180.146920.0009
Override
Cache load0.00200.1639230.0001
Sytem overhead
Fetch class attribute can translate value0.00180.145830.0006
Fetch class attribute name0.00090.074330.0003
XML
Image XML parsing0.00060.045830.0002
class_abstraction
Instantiating content class attribute0.00000.000530.0000
General
dbfile0.00300.2407210.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs