exclude class "on the fly"

Author Message

Nicolas OTTAVI

Monday 05 July 2010 8:06:00 am

Hi,

Is it possible to exclude some classes from the results "on the fly", I mean when the query is made. I have seen a RawFilterList[] in ezfind.ini that could help, but I can not really understand how to use it, and if it make it possible to exclude more than one class.

By the way, the perfect option would be to have a "include" filtering instead of "exclude" ... a little bit like we can do with fetch('content','list|tree' ...)

Thx for your help,

Nico 0

Paul Borgermans

Monday 05 July 2010 10:36:58 am

Hi

"include filtering" is available through the class_id fetch function parameter which takes also arrays

exclude filtering is possible by using a dedicated filter and using the same expression as used in the "hardcoded' ezfind.ini example

{def $results=fetch(ezfind, search, hash('q', '*:*', limit, 10, 
       filter, array('meta_class_identifier_s:[* TO *] -meta_class_identifier_s:folder')))}

hth

Paul

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

Nicolas OTTAVI

Monday 05 July 2010 1:34:49 pm

Thanks Paul,

After posting the question I made a test, and found out that

'filter', array( '-meta_class_identifier_s:(class_to_exclude)') was working ..;

I did not used the meta_class_identifier_s:[* TO *]

Regards,

Nico O

Paul Borgermans

Monday 05 July 2010 1:55:16 pm

That works too in general: as long as a pure negative query is not the only filter query. Safest bet (with the current version of Solr) is to use the [* TO *] expression along the negative query. The next version of solr will allow it in all cases.

Cheers

Paul

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

tofik sahraoui

Sunday 03 July 2011 1:48:34 pm

By the way, there is a typo on the example that comes with the ezfind.ini file. The example that shows how to exclude certain classes from apearing on the searchresult list is missing a 'm' it should be like this:

RawFilterList[]=meta_class_identifier_s:[* TO *] -meta_class_identifier_s:(folder article)

should be this instead:

RawFilterList[]=meta_class_identifier_ms:[* TO *] -meta_class_identifier_ms:(folder article)

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:04:06
Script start
Timing: Jan 18 2025 02:04:06
Module start 'layout'
Timing: Jan 18 2025 02:04:06
Module start 'content'
Timing: Jan 18 2025 02:04:07
Module end 'content'
Timing: Jan 18 2025 02:04:07
Script end

Main resources:

Total runtime1.0783 sec
Peak memory usage4,096.0000 KB
Database Queries67

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0088 587.9453152.6250
Module start 'layout' 0.00880.0086 740.570339.4453
Module start 'content' 0.01741.0594 780.0156609.3281
Module end 'content' 1.07680.0014 1,389.343816.1563
Script end 1.0782  1,405.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3446160.0002
Check MTime0.00140.1284160.0001
Mysql Total
Database connection0.00180.167310.0018
Mysqli_queries1.000192.7528670.0149
Looping result0.00160.1484650.0000
Template Total1.015094.120.5075
Template load0.00240.225520.0012
Template processing1.012593.903620.5063
Template load and register function0.00020.019410.0002
states
state_id_array0.00270.246710.0027
state_identifier_array0.00350.320420.0017
Override
Cache load0.00200.1846360.0001
Sytem overhead
Fetch class attribute can translate value0.00060.059830.0002
Fetch class attribute name0.00120.113980.0002
XML
Image XML parsing0.00500.466630.0017
class_abstraction
Instantiating content class attribute0.00000.0020100.0000
General
dbfile0.00430.3980290.0001
String conversion0.00000.000940.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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs