attribute_filter breaking fetch.

attribute_filter breaking fetch.

Wednesday 08 August 2007 4:16:06 am - 13 replies

Author Message

Paul Borgermans

Wednesday 08 August 2007 1:19:16 pm

Hi Emil

What version of eZ Publish are you running?

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Ole Morten Halvorsen

Wednesday 08 August 2007 3:25:25 pm

Hi Emil,

Did you try to add the wildcard character (*)?

attribute_filter, array(array( 'image/tags' , 'like', '*string*')),

Doc reference: http://ez.no/doc/ez_publish/technical_manual/3_9/reference/modules/content/fetch_functions/list

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Bruce Morrison

Wednesday 08 August 2007 4:48:32 pm

Hi Emil

When you add the attribute_filter line try removing the class_filter_type & class_filter_array lines so you end up with someting like

 children_tag=fetch( 'content', 'list',
                                       hash( 'parent_node_id',  12,
                                       depth,4,
                                       attribute_filter, array(array( 'image/tags' , 'like', '*string*')),
                                       limit, $page_limit,
                                       offset, $view_parameters.offset ) )

I seem to recall that this has worked for me in the past.

Also turn on debugging so you can see the SQL output. This allows you to check the generated SQL and you can tweak the fetch to get the desired result.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Emil Österlund

Thursday 09 August 2007 12:47:08 am

Ole: Yes i tried wildcard.
Paul: 3.7.8
Bruce:
It breaks the fetch, whith this i mean that there is no sql run. I have sqldebug on but cant find the query. i even made it original(like puting depth 15) and did not get any.
As soon as i put in attribute_filter it breaks the fetch.

I am using attribute_filter in other fetches and its fine.

Emil Österlund

Thursday 09 August 2007 12:50:57 am

here is my full code:
http://privat.larsemil.se/galleri.txt

Bruce Morrison

Thursday 09 August 2007 1:02:16 am

Hi Emil

Any errors in the debug?

Try changing

children_tag=fetch( 'content', 'list',

to

children_tag=fetch( 'content', 'tree',

"list" will only return nodes directly under (children) the parent node (12) and depending on the depth of node 12 this may cause issues with depth,4

I'm also assuming they you have a

{def $children_tag=...

in there.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Emil Österlund

Thursday 09 August 2007 1:25:32 am

bruce:
The thing is: The sql/fetch is run if i dont have attribute filter. It shows all the objects only they are unfiltered. It is first when i add attribute_filter it screws up.

On the same page i have other fetches, and they work perfectly fine.
It is just that one line of attribute_filter that is screwing it up. And i am using attribute_filter in other templates without any problems what so ever.

Emil Österlund

Monday 13 August 2007 1:44:23 am

no more ideas?

Heath

Monday 13 August 2007 1:51:01 am

A number of suggestions have been made, why don't you share the current fetch you have in your template for review.

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

Emil Österlund

Monday 13 August 2007 2:13:20 am

Here we go:

http://privat.larsemil.se/galleri.txt

also i tried leaving class_filters out.

Heath

Monday 13 August 2007 2:57:01 am

Emil,

I took a moment to <i>really</i> test for myself how to do this this morning and found this worked great for me :)

{def $c=fetch( 'content', 'tree', hash( 'parent_node_id', 175,
                depth, 7,
                attribute_filter, array( array( 'article/keywords', 'like', '*string*' ) )
                ) )}

{$c|attribute(show,1)}
{$c.0|attribute(show,1)}

Also works by id just fine ...

{def $c=fetch( 'content', 'tree', hash( 'parent_node_id', 175,
                depth, 7,
                attribute_filter, array( array( 865, 'like', '*string*' ) )
                ) )}

Also works with a variable works as well like this ...

{def $tag='string'}
{def $c=fetch( 'content', 'tree', hash( 'parent_node_id', 175,
                depth, 7,
                attribute_filter, array( array( 'article/keywords', 'like', concat( '*', $tag, '*' ) ) )
                ) )}

Remember to clear all cache before testing, also consider the following, <i>http://ezpedia.org/wiki/en/ez/solution_template_development_without_clearing_cache</i>

For future users we have published the following documentation on eZpedia for long term storage and searching! eZpedia is your friend :)
<i>http://ezpedia.org/wiki/en/ez/solution_how_to_do_an_attribute_filter_using_the_like_condition</i>

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

Emil Österlund

Monday 13 August 2007 3:44:46 am

{def $c=fetch( 'content', 'tree', hash( 'parent_node_id', 3,
               depth, 17,
               attribute_filter, array( array( 'image/tags', 'like', '*larsemil*' ) )
               ) )}

{$c|attribute(show,1)}
{$c.0|attribute(show,1)}

i put this in my code as this 'should' work then.
3 is the lowest node containing all users and everyting.
depth 17 should cover all images by far.
and i looked up and it should be image/tags.

i ony get this output:
Attribute Type Value
Attribute Type Value

is it me or is it my ez publish?

Heath

Monday 13 August 2007 5:29:12 am

Emil,

I think your continued breakdowns in search of a resolution and working solution derive from a number of combined factors.

1) Your using an unsupported branch which is very old, (Re: eZ publish <i>3.7.8</i>)

2) Your using a dirty installation, I can't see it but I'm certain you are.

By dirty I mean it's in an unknown state (the database could be corrupt for all you know for certain), it's using an old version of eZ (lots of bug fixes you may need are not available), it's an old installation with lots of customizations also in an unknown state. The solution / site as a whole could not be certified without much cleanup and re-organizing in a stable clean install of eZ Publish (Which you should do ... now instead of later)

3) Your new to eZ Publish. This is not so bad except you need professional help to lead you to stability and experience, I hope your employer supports you in seeking this experience and support.

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

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

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