Forums / Extensions / eZ Find / exclude class "on the fly"

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)

eZ debug

Timing: Jan 17 2025 23:48:25
Script start
Timing: Jan 17 2025 23:48:25
Module start 'content'
Timing: Jan 17 2025 23:48:25
Module end 'content'
Timing: Jan 17 2025 23:48:25
Script end

Main resources:

Total runtime0.1468 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.7422180.7813
Module start 'content' 0.00610.0049 768.523498.9766
Module end 'content' 0.01100.1358 867.5000527.9766
Script end 0.1467  1,395.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00352.3693200.0002
Check MTime0.00140.9269200.0001
Mysql Total
Database connection0.00060.435310.0006
Mysqli_queries0.103970.75481410.0007
Looping result0.00171.17731390.0000
Template Total0.135492.310.1354
Template load0.00080.576910.0008
Template processing0.134691.677410.1346
Override
Cache load0.00060.403910.0006
Sytem overhead
Fetch class attribute can translate value0.00080.574910.0008
XML
Image XML parsing0.00020.153310.0002
General
dbfile0.00191.2676200.0001
String conversion0.00000.004130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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