Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Customizing Facets and Drill Down Navigation

Facets were introduced in eZ Find 2.0 to enable you to create browse-based search functionality. In other words, the search results can be further narrowed after the original search has been made. This is sometimes called “drilling down” into the results. Facets refer to the characteristics of the content objects in the results, such as their class, author, and translation. The default templates provide some simple facet examples, although eZ Find is capable of providing much more functionality.

In order to use facets you must customize the search templates. To make this easier, the template operators facetParameters and filterParameters have been added, which provide default parameters to implement facet functionality. Facet-related parameters are described in more detailed in the next section about the eZ Find fetch function.

Range Facets

Audience

This feature is for (template) developers building advanced search and navigation interfaces.

Goals and Use Cases

Range facets are a general type of facets, like date facets. They should be used to stitch together what otherwise could also be obtained with discrete query facets operating on numeric and date types.
 
Important: Range facets should also be used for date facets as the latter one is deprecated also in Solr!

How to Use

There can be multiple range facets specified, just like the field facets (but unlike the date facets in previous releases, where only one date facet could be called per fetch query).

Example of template code:

fetch( ezfind, search, hash( 'query', '$queryString, facet',array( hash( 'range', hash('field', 'published', 'start', 'NOW/YEAR-3YEARS', 'end', 'NOW/YEAR+1YEAR', 'gap', '+1YEAR' ) ) ) ) )

The parameters accepted as a hash array for the 'range' facet type are:

Name

Required

Value/Description

field

yes

The field name to use (meta data or attribute).

start

yes

Range start: any value valid for the numeric/data type.

end

yes

Range end: any value valid for the numeric/data type.

hardend

no

Strig 'true' or 'false' (default) instructing Solr what to do if the intervals do not divide nicely between start and end.

If 'true', the 'end' parameter will be enforced. Otherwise, the gap will be used to determine the real end value.

other

no

String. Will be used to tell the back end  to provide more, less, all or no counts other than the ones in specified range:

  • before: all records with field values lower than the lower bound value of the first range
  • after: all records with field values greater than the upper bound value of the last range
  • between: all records with field values between the start and the end bound values of all ranges
  • none: no records will be computed
  • all: means all counts (shortcut to 'before', 'between' and 'after')

include

no

By default, the ranges used to compute range faceting between range start and range end.

The lower bounds are inclusive and the upper bounds are exclusive (i.e.: the 'before' range is exclusive and the 'after' range is inclusive).

This is the default behaviour, equivalent to 'lower' (see description below), and will not result in double counting at the boundaries.

This behaviour can be modified by the facet range.include parameter, which can be any combination of the following options:

  • 'lower': all gap based ranges include their lower bound
  • 'upper': all gap based ranges include their upper bound
  • 'edge': the first and last gap ranges include their edge bounds (i.e.: lower for the first one, upper for the last one), even if the corresponding upper/lower option is not specified
  • 'outer': the "before" and "after" ranges will include their bounds, even if the first or last ranges already include those boundaries
  • 'all': shorthand for lower, upper, edge, outer

Ricardo Correia (05/02/2013 2:10 pm)

Ricardo Correia (05/02/2013 2:10 pm)


Comments

There are no comments.