Numeric range facets

Managed by | Updated .


This article outlines a method of producing faceted navigation for numeric ranges.

For example assume a collection contains a numeric (type 3) metadata field holding the price of the item.

This article will show how to produce facets for preset price ranges (such as $0-99, $100-199, $200+).


The script has only been tested on Linux. The script should work under Windows, but may require minor modification.


The collection must contain numeric metadata for the field that range facets are required for.


It's not possible to achieve range facets with Funnelback unless you have either assigned a metadata value for each of the given price ranges and have tagged each product accordingly, or you have used some other method to take the product's price and assign it to a price range (eg. groovy filter script that reads the value and writes additional metadata at crawl time).

The following method can be used to create ranges to an existing collection, provided the collection contains numeric-type metadata containing the value of the attribute that will be assigned to a range.

The ranges that are produced are static (they are pre-computed so you can't adjust these ranges with a slider control at search time).

The gscope config file that is produced contains document numbers. When running padre-gs the -docnum argument must be supplied. padre-gs can only process gscope.cfg files with a maximum of 10,000 lines when the gscopes are applied against URLs.

Step 1. Install the range gscopes code

Download the range facets code from GitHub.

The file should be placed within a @workflow folder under the collection's configuration folder.

Step 2. Configure the numeric ranges

Create a ranges.cfg file containing the desired ranges. Steps for configuring the numeric ranges are outlined in the range-gscopes documentation.

Step 3. Add the workflow command

Add a command to the collection's update workflow to run the range-gscopes script. Steps for configuring the workflow command are outlined in the range-gscopes documentation.

Step 4. Update the collection

Run an update of the collection to ensure the ranges are applied to the collection index.

Step 5. Configure faceted navigation

  1. Edit the collection's faceted navigation.

  2. Add a new gscope facet and assign an appropriate name (eg. Price range)

  3. For each applicable range, add a category of type Gscope item, using the gscope number you have defined in your ranges.cfg and assign an appropriate label. For the above example you would create a facet (eg. Price range) then add three category elements. The first would have a name like "$0-100" and the Gscope (eg. 3) field set to 10.

    e.g. for the example ranges outlined in the range facets documentation the following gscopes would be appropriate:

    • Facet name: Price
    • Source: General scope number item
    • Categories:
      • 10 as $0-99
      • 11 as $100-199
      • 12 as $200+

    This creates a single facet (Price) containing three categories that correspond to the ranges that were defined in ranges.cfg.

Was this artcle helpful?

Type: Keywords:
Features: Frontend > Faceted navigation