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.

eZ debug

Timing: Jan 30 2025 19:35:35
Script start
Timing: Jan 30 2025 19:35:35
Module start 'layout'
Timing: Jan 30 2025 19:35:35
Module start 'content'
Timing: Jan 30 2025 19:35:35
Module end 'content'
Timing: Jan 30 2025 19:35:35
Script end

Main resources:

Total runtime0.0240 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.4063151.2422
Module start 'layout' 0.00470.0051 739.6484220.7500
Module start 'content' 0.00980.0127 960.3984999.0391
Module end 'content' 0.02250.0015 1,959.437533.9922
Script end 0.0240  1,993.4297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002610.9237140.0002
Check MTime0.00104.2277140.0001
Mysql Total
Database connection0.00072.802910.0007
Mysqli_queries0.003514.575530.0012
Looping result0.00000.070510.0000
Template Total0.00124.810.0012
Template load0.00093.698510.0009
Template processing0.00031.128910.0003
Override
Cache load0.00062.665910.0006
General
dbfile0.00104.288380.0001
String conversion0.00000.027840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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