Forums / Extensions / eZ Find: Cross class filter

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

eZ debug

Timing: Jan 29 2025 13:41:31
Script start
Timing: Jan 29 2025 13:41:31
Module start 'content'
Timing: Jan 29 2025 13:41:31
Module end 'content'
Timing: Jan 29 2025 13:41:31
Script end

Main resources:

Total runtime0.0120 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.1328180.8438
Module start 'content' 0.00540.0035 768.976698.6016
Module end 'content' 0.00880.0031 867.578174.6875
Script end 0.0119  942.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.001815.4433120.0002
Check MTime0.00087.0469120.0001
Mysql Total
Database connection0.00086.771810.0008
Mysqli_queries0.002420.395140.0006
Looping result0.00000.099720.0000
Template Total0.002823.810.0028
Template load0.00064.892010.0006
Template processing0.002318.898010.0023
Override
Cache load0.00043.418810.0004
General
dbfile0.00032.2088100.0000
String conversion0.00000.031930.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs