Filter manager bundle for product lists.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Controller Upgrading to elastic 5.0 support (#205) Nov 9, 2016
Event changed filter instace to filter state instance in event Sep 20, 2016
Filter Fix doc Oct 11, 2017
Relation Replace plural to singular in namespaces and class names Dec 22, 2015
Resources Merge pull request #232 from einorler/example_docs Mar 22, 2017
Search switched serialization to jms instead of custom Mar 20, 2017
Tests deleted no longer relavant test Mar 22, 2017
Twig fix PagerExtension is dependent to deprecated function Twig_Function Feb 22, 2017
.coveralls.yml removed deprecated src config Dec 31, 2015
.gitignore removed .DS_Store from gitignore Apr 27, 2015
.scrutinizer.yml added .scrutinizer.yml file Mar 23, 2015
.travis.yml drop php 5 support Feb 14, 2017 Merge branch '1.0' into 2.0 Mar 24, 2017
LICENSE Update copyright year Jan 13, 2016
ONGRFilterManagerBundle.php Remaster Filter manager bundle (#201) Oct 28, 2016
ONGRFilterManagerEvents.php added a Sep 20, 2016 updated the readme to include the serializer bundle in kernel Mar 22, 2017
SerializableInterface.php Add a way to serialize search response and controller action to get i… Nov 27, 2015
composer.json Bumped development version to 2.1 Mar 24, 2017
phpunit.xml.dist Fixed float values in range filter. Jan 14, 2015

ONGR FilterManagerBundle

Filter manager is used for listing documents. It provides ties between commonly used filtering options and UI elements with Elasticsearch repositories. It is important to mention that filtering is everything what has impact on list, it can be:

  • Filtering on specific field value object have (color, country etc.)
  • Filtering range (price range, distance from point etc.)
  • Documents list pagination. Paging changes representation of list, so it is considered to be filter and is treated like one.
  • Documents list sorting. Same as paging - sorting is filter in this bundle.
  • Any custom factor which has influence (not always directly visible) on result list. It can exclude, boost, modify some results, collect some metrics or any other action you can imagine.

If you need any help, stack overflow is the preffered and recommended way to ask ONGR support questions.

Build Status Coverage Status Latest Stable Version Scrutinizer Code Quality


For online documentation of the bundle click here. All docs pages are located in Resources/doc/.


Step 1: Install FilterManager bundle

FilterManager bundle is installed using Composer.

# You can require any version you need, check the latest stable to make sure you are using the newest version.
$ composer require ongr/filter-manager-bundle "~2.0"

Please note that filter manager requires Elasticsearch bundle, guide on how to install and configure it can be found here.

Step 2: Enable FilterManager bundle

Enable Filter Manager bundle in your AppKernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = [
        // ...
        new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),
        new ONGR\FilterManagerBundle\ONGRFilterManagerBundle(),
        new \JMS\SerializerBundle\JMSSerializerBundle(),
    // ...

Step 3: Add configuration for manager

Add minimal configuration for Elasticsearch and FilterManager bundles.

# app/config/config.yml

                index_name: products

        search_list: # <- Filter manager name
                - country
            repository: es.manager.default.product # <- Product document repository service to execute queries on
        country: # <- Filter name
            type: choice
            request_field: country
            document_field: country

Note that Product document has to be defined. More about that in ElasticsearchBundle documentation.

In this particular example, we defined a single filter manager named search_list to filter documents from product repository, and we will be using the filter named country to filter on countries defined in document.

Step 4: Use your new bundle

FilterManagerBundle is ready to use. When you define filter manager the bundle generates a service according manager name. In this particular case it will be ongr_filter_manager.manager.search_list.

To get a list grab the service and call handleRequest(). Here's a short example in the controller:

use ONGR\FilterManagerBundle\DependencyInjection\ONGRFilterManagerExtension;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ProductController extends Controller
     * @param Request $request Request.
     * @return Response
    public function listAction(Request $request)
        $searchList = $this->get(ONGRFilterManagerExtension::getFilterManagerId('search_list'))
              'filters' => $searchList->getFilters(),  
              'products' => $searchList->getResult(),  

More information how to use filters and render the results are in basics topic here.


If you face any issue or difficulty by implementing bundle, do not be afraid to create an issue with bug or question. Also ONGR organization has a tag in Stackoverflow so you can ask about all ONGR bundles also there.


This bundle is covered by the MIT license. Please see the complete license in the bundle LICENSE file.