Forums / Extensions / eZ Find / ezFind empty field

ezFind empty field

Author Message

Ivan Švogor

Tuesday 22 March 2011 8:22:08 am

Hi,

I'm filtering my articles in the way you don't see ones that are expired, It looks similar to this:

[1]   {set $filter = $filter|append('article/unpublish_date:[NOW/DAY-100DAY TO NOW]')}

This is supposed to print out all the articles that are expired (not older than 100 day). Now, It works ok. When I want to printout only those that are not expired I use something like this:

[2]  {set $filter = $filter|append('article/unpublish_date:[NOWTO NOW/DAY+100DAY]

Also, works ok. The problem: I have a lot of articles with unset attribute unpublish_date. So the filter 2 prints only the ones that have unpublish_date set. (therefore this question essentialy means, can I do something like this?:)

{set $filter = $filter|append('article/unpublish_date:[" "]')} -> not working :)

Is there a way to print out and those ones that have this field empty? If I need to set unpublish_date to all the early articles (when default value was not set) I will shoot myself :)

tnx

Ivan Švogor

Wednesday 23 March 2011 1:47:06 am

Yeah... I've figured it out..

Someone on this forum sayd that [ * TO NOW] or any combination of this will work for dates. For some reason it does not work for me. So where the * comes, I just use some timespan that will not happen. I doubt that articles will be older than 100 years, or unpublish date will be later than 100 years.

So I'm using this:

[NOW TO NOW/DAY+100DAY]

If attribute unpublish_date is not set, some suggest you set the filter like so:

'-article/unpublish_date:[* TO *]'

But it doesn't work for me :)

So the solution to my question is:

For all articles that are expired:

'article/unpublish_date:[NOW/DAY-100YEAR TO NOW]'

And for all that are not expired, and also don't have the unpublis_date attribute set:

'filter', array('or', 'article/unpublish_date:1970-01-01T01\:00\:00Z', 'article/unpublish_date:[NOW TO NOW/DAY+100YEAR]')

And that's it, I hope someone else will find this useful.

eZ debug

Timing: Jan 17 2025 23:46:10
Script start
Timing: Jan 17 2025 23:46:10
Module start 'content'
Timing: Jan 17 2025 23:46:10
Module end 'content'
Timing: Jan 17 2025 23:46:10
Script end

Main resources:

Total runtime0.8981 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0081 587.7344180.7969
Module start 'content' 0.00820.7864 768.5313441.5234
Module end 'content' 0.79450.1035 1,210.0547333.4766
Script end 0.8980  1,543.5313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.4691210.0002
Check MTime0.00150.1673210.0001
Mysql Total
Database connection0.00080.087610.0008
Mysqli_queries0.838393.34071910.0044
Looping result0.00160.18071890.0000
Template Total0.864496.220.4322
Template load0.00210.230020.0010
Template processing0.862396.015820.4311
Template load and register function0.00020.022710.0002
states
state_id_array0.00130.146910.0013
state_identifier_array0.00120.128820.0006
Override
Cache load0.00160.1830260.0001
Sytem overhead
Fetch class attribute can translate value0.00110.125620.0006
Fetch class attribute name0.00130.146520.0007
XML
Image XML parsing0.00030.035020.0002
class_abstraction
Instantiating content class attribute0.00000.000820.0000
General
dbfile0.00170.1905210.0001
String conversion0.00000.000730.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs