Share » Forums » Extensions » eZ Find » exclude class "on the fly"

exclude class "on the fly"

exclude class "on the fly"

Monday 05 July 2010 8:06:00 am - 4 replies

Author Message

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)

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu