Forums / Developer / Search by multiple attributes

Search by multiple attributes

Author Message

Marco Zinn

Saturday 15 November 2008 1:42:03 pm

Hi there,

just a quick one:
Let's say, i have a class containing 10 attributes.
Now, i want to search objects matching search criteria of 5 attributes, that is fetch a list of them.

e.g.
Search all "Cats" where "color=black" and "size=small" and "Eyes=green" and "age<2"

How do i do this?

I only found a the docs on searching by one attribute.

Marco

Marco
http://www.hyperroad-design.com

Ivo Lukac

Sunday 16 November 2008 1:22:59 am

Hello Marco,

AFAIK you can't. Except with the new ezFind 2.0.0 alpha and facets functionality....

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Stefan de Bruijn

Sunday 16 November 2008 5:49:27 am

From your example i think you can use the attribute filter from the fetch list function and not the search function.

With this you can filter on multiple attributes from the same class.

You cannot however do a search within this result. So you can get all results where "color=black" and "size=small" and "Eyes=green" and "age<2".
If "Cats" is also an attribute you can filter on this too. For instance list all results where "species=Cats" and "color=black" and "size=small" and "Eyes=green" and "age<2".

You cannot search for the occurence of "Cats" in all the (searchable) attributes in the resulted list ( where "color=black" and "size=small" and "Eyes=green" and "age<2". )

See the reference for usage and several examples.

Marco Zinn

Sunday 16 November 2008 10:30:54 am

Hi Stefan,

ah, yes, you're right.
I'll probably rather need a filter, than a search functionality.

Reference (so, others may skip the searching ;) ):
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list
-> Section "Attribute filtering"

Thanks for pointing me in the right direction.

Marco
http://www.hyperroad-design.com