Attribute filtering with integers in eZ Find 2?

Author Message

Jordan Hirsch

Monday 09 February 2009 6:04:40 am

I have just read the latest documentation for eZ Find 2 (http://svn.ez.no/svn/extensions/ezfind/docs/ezfind_1.1_manual.pdf) and I see you can add attribute filters to an eZ Find search using facets, like so:

fetch( ezfind, search, 
    hash( query, 'eZ Systems',
        filter, array( 'car/in_stock:1',
                'car/make:Alfa Romeo',
                'car/model:8C' ) ) )

Is it possible to do more advanced filtering such as greater-than or less-than on integer fields using eZ Find? What would would the code look like? I am new to eZ Find and even newer to facets, so please forgive me if this is obvious, but I can't find it in the documentation.

Thank you in advance for your help.

Me: http://jordan.teamhirsch.com
My blog: http://wiredformusic.blogspot.com
My other company: http://thinkimprov.com
eZ Certification: http://auth.ez.no/certification/verify/402488
eZ Award: http://ez.no/company/news/ez_awards_2007_prize_winners

Nicolas Pastorino

Friday 20 February 2009 2:22:43 am

Hi Jordan,

First, do not forget to check the latest stable version of eZ Find :
* http://ez.no/company/news/ez_systems_releases_apache_solr_based_open_source_enterprise_search_solution_ez_find_2_0
* http://ez.no/doc/extensions/ez_find
* http://ez.no/ezfind/download

You can use a bunch of Solr query syntax bits in the 'filter' parameter of the fetch function, among them a range search, with finite or unfinite bounds. A code example would be :

fetch( ezfind, search,
   hash( query, 'eZ Systems',
       filter, array( 'article/rating:[3 TO *]' 
            )))

This would return all articles containing the words 'ez' and 'systems', for which the rating is higher than 3. You could inverse the filter by using the following syntax in place :

[* TO 4]

I hope it helped,
Best Regards,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.