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

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

eZ debug

Timing: Jan 18 2025 16:04:18
Script start
Timing: Jan 18 2025 16:04:18
Module start 'layout'
Timing: Jan 18 2025 16:04:18
Module start 'content'
Timing: Jan 18 2025 16:04:19
Module end 'content'
Timing: Jan 18 2025 16:04:19
Script end

Main resources:

Total runtime1.1846 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0089 587.9141152.6250
Module start 'layout' 0.00890.0037 740.539139.4453
Module start 'content' 0.01261.1706 779.9844595.7891
Module end 'content' 1.18320.0014 1,375.773412.1641
Script end 1.1846  1,387.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3415160.0003
Check MTime0.00140.1178160.0001
Mysql Total
Database connection0.00120.098610.0012
Mysqli_queries1.124594.9270620.0181
Looping result0.00080.0651600.0000
Template Total1.145996.720.5730
Template load0.00270.228120.0014
Template processing1.143296.503420.5716
Template load and register function0.00020.017510.0002
states
state_id_array0.00180.154510.0018
state_identifier_array0.00230.197520.0012
Override
Cache load0.00180.1487330.0001
Sytem overhead
Fetch class attribute can translate value0.00140.122030.0005
Fetch class attribute name0.00130.110460.0002
XML
Image XML parsing0.00110.091830.0004
class_abstraction
Instantiating content class attribute0.00000.001370.0000
General
dbfile0.00090.0773230.0000
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/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
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs