Forums / General / attribute_filter is not working with eZ 3.3.3

attribute_filter is not working with eZ 3.3.3

Author Message

Hardy Pottinger

Friday 27 August 2004 3:01:34 pm

collectionList=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
                                'sort_by', $node.sort_array,
                                'offset', $view_parameters.offset,
                                'limit', $numberOfObjects,
                                'attribute_filter', array('or',array(192, '=', 'foobar'))))

I've tried a number of permutations of the above sample code, and am not having any luck, so before I spend any more days on tracing exactly how the attribute_filter works, I want to see if it's known NOT to work with eZ 3.3.3?

I've been searching the forums all day, and while I see a number of people have similar problems, I haven't found any clue towards a workable solution.

This discussion looks promissing, though it died off ages ago:

http://ez.no/community/forum/general/attribute_filter_needs_more_explanation

Here's what debug is telling me:

Undefined offset: 192 in /path/kernel/classes/ezcontentobjecttreenode.php on line 419
Undefined index: in /path/kernel/classes/ezcontentobjecttreenode.php on line 419

Hardy Pottinger

Monday 30 August 2004 12:12:01 pm

The lack of response leads me to believe that I need to do some kernel debugging to get this to work, so that's where I'll head next. If there's anyone out there listening, and you have an idea of what's up here, I could use the help. Thanks.

Paul Borgermans

Monday 30 August 2004 12:20:12 pm

I don't think there is anything wrong, but against what dataype are you checking?

Also, turn on SQL output in debugging (warning: long pages )

-paul

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

Hardy Pottinger

Monday 30 August 2004 12:45:06 pm

Good question--both a custom datatype, and in a test instance, a string datatype. No luck in either case. The SQL debug indicates, immediately following the two error messages noted orginally,

 
SELECT ezcontentobject.*,
                             ezcontentobject_tree.*,
                             ezcontentclass.name as class_name
                             
                             , ezcontentobject_name.name as name,  ezcontentobject_name.real_translation 
                      FROM
                            ezcontentobject_tree,
                            ezcontentobject,ezcontentclass
                            , ezcontentobject_name 
                            
                            , ezcontentobject_attribute as a1 
                            
                      WHERE
                             path_string like '/1/2/50/%' and  depth <= 3 and 
                            
                            
                            
                               a1.contentobject_id = ezcontentobject.id AND
                               a1.contentclassattribute_id = 192 AND
                               a1.version = ezcontentobject_name.content_version AND
                               a1.language_code = ezcontentobject_name.real_translation AND 
                            ( a1.sort_key_int = 'why ist this looking in an integer field for a string'  ) AND 
                            ezcontentclass.version=0 AND
                            node_id != 50 AND
                            ezcontentobject_tree.contentobject_id = ezcontentobject.id  AND
                            ezcontentclass.id = ezcontentobject.contentclass_id AND
                            
                            ezcontentobject_tree.contentobject_is_published = 1
                             and  ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
                              ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
                              ezcontentobject_name.content_translation = 'eng-US' 
                     
                     ORDER BY ezcontentobject_name.name ASC
LIMIT 0, 10

I haven't dug into this yet, but my hunch is that the code that handles filtering in the string datatype (which is what my custom datatypes are based on) is goofed up in some fashion.

Paul Borgermans

Monday 30 August 2004 1:11:32 pm

Ah,

Does your datatype has the following:

function &sortKey( &$contentObjectAttribute )
    {
        return strtolower( $contentObjectAttribute->attribute( 'data_text' ) );
    }

    /*!
     \reimp
    */
    function &sortKeyType()
    {
        return 'string';
    }

hth

-paul

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

Paul Borgermans

Monday 30 August 2004 1:21:41 pm

oops

Probably not that, the ezstring datatype has it. Yours is verbatim copy of this one when you started it?

-paul

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

Hardy Pottinger

Monday 30 August 2004 1:23:16 pm

Yup. I checked both the 3.3.3 kernel's string datatype, as well as all of my custom datatypes (which are all based on that string datatype). They all have the code you note.

Paul Borgermans

Monday 30 August 2004 1:48:33 pm

Well,

I'm out of ideas now. The query is obviously wrong, but I can't find anything that could lead to this in /kernel/classes/ezcontentobjecttreenode.php, given the correct class functions.

This isn't by any chance a cache leftover from an upgrade? Could you try it out on a new install (here it works, but I'm on 3.4.2) or upgrade? I remember some weird template bugs with 3.3 and 'complex' fetches, but that should not lead to the wrong query...

-paul

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

Hardy Pottinger

Monday 30 August 2004 2:02:20 pm

Nope, it's always been a 3.3.3 installation.

Thinking about trying an upgrade first, though I'll probably end up with a new mess to sort out. :-\ Suppose it can't hurt, maybe it will just work. :-)

Thanks for trying, anyway.

Hardy Pottinger

Thursday 02 September 2004 1:57:08 pm

Good news/bad news. The good news is that my site was easily upgraded to eZ 3.4-1. The bad news is that this did not change the behavior of this problem at all.

Immediately after the same warnings I mentioned originally (reproduced here),

Undefined offset: 192 in /path/kernel/classes/ezcontentobjecttreenode.php on line 449
Undefined index: in /path/kernel/classes/ezcontentobjecttreenode.php on line 449

I see the same weird error in the SQL:

...
( a1.sort_key_int = 'why am I looking at an integer when I should be looking at a string'  ) AND 
...

It's really starting to look like there's something up with the parent string datatype from ez upon which I've based all my custom datatypes.

Any ideas?