eZ Find: Cross class filter

Author Message

Anders Berre

Monday 24 January 2011 7:19:49 am

Hi!

Is it possible to do cross class filter with eZ Find. Lets say I want to search in three classes.

Article, Products and Persons

But the search result should only show me articles published in a given timerange.

The first part is easy, show articles published in a given timerange, but the result only shows articles. I want it to show me the products and persons that matches the search word aswell.

Good ideas anyone?

Franck Magnan

Monday 24 January 2011 12:40:55 pm

Hello Anders,

ezfind fetch function looks like :

{set $search=fetch( ezfind,search,
                        hash( 'query', $search_text,
                              'offset', $view_parameters.offset,
                              'limit', $page_limit,
                              'sort_by', hash( 'score', 'desc' ),
                              'facet', $defaultSearchFacets,
                              'filter', $filterParameters,
                              'publish_date', $dateFilter,
                              'spell_check', array( true() ) 
                             ))}

Assuming Article, Product and Persons have class_ids 34, 67 and 55 (for example), you can add one argument to your fetch function to get :

{set $search=fetch( ezfind,search,
                        hash( 'query', $search_text,
                              'offset', $view_parameters.offset,
                              'limit', $page_limit,
                              'sort_by', hash( 'score', 'desc' ),
                              'facet', $defaultSearchFacets,
                              'filter', $filterParameters,
                              'publish_date', $dateFilter,
                              'class_id', array(34, 67, 55),
                              'spell_check', array( true() ) 
                             ))}

Then, ezfind will retrieve only nodes among Articles, Products and Persons.

Hope this helps.

--
Developer at Open Wide

Anders Berre

Tuesday 25 January 2011 12:21:43 am

Hi Franck,

Thanks for taking your time to answer. I think you misunderstod the problem. The problem is not to have define wich classes to use, but to get any other classes as well, when using filter on on of them.

Franck Magnan

Tuesday 25 January 2011 12:08:03 pm

Sorry if I didn't understand your problem.
Perhaps you can read these 3 very interesting tutorials:

hope this helps

--
Developer at Open Wide

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 02:43:39
Script start
Timing: Jan 18 2025 02:43:39
Module start 'layout'
Timing: Jan 18 2025 02:43:39
Module start 'content'
Timing: Jan 18 2025 02:43:40
Module end 'content'
Timing: Jan 18 2025 02:43:40
Script end

Main resources:

Total runtime1.0572 sec
Peak memory usage4,096.0000 KB
Database Queries61

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 589.0313152.6250
Module start 'layout' 0.00750.0032 741.656339.4531
Module start 'content' 0.01071.0449 781.1094566.0000
Module end 'content' 1.05560.0016 1,347.109412.1641
Script end 1.0571  1,359.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3235160.0002
Check MTime0.00140.1327160.0001
Mysql Total
Database connection0.00150.143510.0015
Mysqli_queries0.990493.6801610.0162
Looping result0.00080.0720590.0000
Template Total1.019096.420.5095
Template load0.00230.214720.0011
Template processing1.016796.169520.5083
Template load and register function0.00010.014210.0001
states
state_id_array0.00120.112310.0012
state_identifier_array0.00140.129720.0007
Override
Cache load0.00190.1841350.0001
Sytem overhead
Fetch class attribute can translate value0.00120.112820.0006
Fetch class attribute name0.00110.106660.0002
XML
Image XML parsing0.00310.289520.0015
class_abstraction
Instantiating content class attribute0.00000.002180.0000
General
dbfile0.00300.2831210.0001
String conversion0.00000.000840.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
4content/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
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
3content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 10

Time used to render debug report: 0.0001 secs