Forums / Setup & design / attribute_filter for two classes

attribute_filter for two classes

Author Message

Marcin Drozd

Friday 14 July 2006 4:50:52 pm

Hi
I have two classes: classA and classB.
Each of these classes consist of special attribute: attX.
Attribute ID of attX (classA) = 100
Attribute ID of attX (classB) = 200

I'd like fetch all node where attX=extra_value (object of classes classA and classB)

I'd use fetch only one time

I think it is imposible
and the code
'attribute_filter', array( 'or',
array( 100, '=', 'extra_value' ),
array( 200, '=', 'extra_value' ) )
doesn't work, because arributes with ID={100, 200} are in diferrent classes.

http://ez-publish.pl

Kristof Coomans

Tuesday 18 July 2006 2:03:22 am

Filtering on attributes from two different classes is currently impossible. Try to use two fetches and merge the results with the merge operator ( http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/arrays/merge ).

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Marcin Drozd

Tuesday 18 July 2006 2:46:16 am

Hi
thx
it is easy with two classes, but complicated when I have ten classes :(
I think I should create an extension :]

http://ez-publish.pl

Paul Borgermans

Tuesday 18 July 2006 3:00:00 am

Hi

Then the search fetch function is for you: you can pass an array of class id's

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/search

Our lucene search plugin also supports this (of course)

--paul

<i>The weather is so nice now in Belgium, but being addicted to Lucene and Lire makes me glued to my laptop</i>

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

Marcin Drozd

Sunday 23 July 2006 1:52:27 pm

Hi
thank U
I'm going to use this function but:

I have some attributes (for each classes) and one specific attribute (for ones), also I have ten extra attributes (and ten attributeIDs)
I dont want to search through all attributes in class, and I cannot disable searching for these attributes but I have another search too (for these attributes). I'd like search out only in specific attribute (attributes).
Also, if I set class_id={class_ID_1, class_ID_2, ..., class_ID_10}, I'll get results for all attributes.

It works with class_attribute_id and attribute IDs belong to one class.
Can I use class_attribute_id={att_ID_1, att_ID_2, ..., att_ID_10} (att_ID_i is in class_i, and i=1..10) ? (ten attributes proceed from ten classes)

And google navigator dosn't work because there is

&SearchContentClassID=',$search_contentclass_id

in advancedsearch.tpl (and GET method)
and I have to change this code, because $search_contentclass_id is array.

http://ez-publish.pl

Marcin Drozd

Wednesday 26 July 2006 10:44:48 am

<i>It works with class_attribute_id and attribute IDs belong to one class.
Can I use class_attribute_id={att_ID_1, att_ID_2, ..., att_ID_10} (att_ID_i is in class_i, and i=1..10) ? (ten attributes proceed from ten classes)</i>

I've just tested this.
I know I can use 10 attributes (from 10 classes). It works.

http://ez-publish.pl