PHPackages                             it/search-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. it/search-bundle

ActiveSymfony-bundle[Search &amp; Filtering](/categories/search)

it/search-bundle
================

A Symfony2 bundle for indexing and searching into single/multiple entities

1.3.5(9y ago)0771MITPHPPHP &gt;=5.5

Since Jan 25Pushed 9y ago2 watchersCompare

[ Source](https://github.com/IntuitivTechnology/SearchBundle)[ Packagist](https://packagist.org/packages/it/search-bundle)[ RSS](/packages/it-search-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (12)Used By (0)

SearchBundle
============

[](#searchbundle)

Symfony2 Bundle : fulltext index and search for multiple Doctrine entities

Installation
------------

[](#installation)

Install with composer :

```
composer require it/search-bundle
```

### Enable the bundle in your project

[](#enable-the-bundle-in-your-project)

```
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new IT\SearchBundle\ITSearchBundle(),
        // ...
    );
}
```

Config
------

[](#config)

Add the following line to your `config.yml` :

```
# app/config/config.yml

imports:
    - { resource: ../../vendor/it/search-bundle/IT/SearchBundle/Resources/config/config.yml }

it_search:
  indexes:
    enable_event_listener: ~ # Default to false, enables an Event listener that automatically update/create a mapped entity index
    min_score: ~ # Default to 0.8. Minimum score for the MATCH_AGAINST mysql function
    use_result_cache: ~ # Default to false. Enables the Doctrine result cache for 3600s
    projects:
      classname: 'ACMEBundle\Entity\EntityFQCN'
      identifier: id #identifier fieldName
      fields:
        - title
        - description
        #Other fields
      filters: #array used in a findBy method while indexing content
        isPublished: true
    news:
      classname: 'ACMEBundle\Entity\EntityFQCN2'
      identifier: id #identifier fieldName
      fields:
        - title
        - catchphrase
        - content
        #Other fields
      filters: #array used in a findBy method while indexing content
        published: true
```

CLI Tools
---------

[](#cli-tools)

To manually index the fields, use the following command :

```
php app/console search:index:build -d
```

How to use the bundle
---------------------

[](#how-to-use-the-bundle)

In your controller, use the following lines to get the results in your search page :

The **search()** function returns a SlidingPagination object (from Knp/Paginator).

```
$databaseSearcher = $this->get('it_search.database.searcher');
$results = $databaseSearcher->search($terms, $page = 1, $limit = 10, array $entityClassnames = array(), $enableLikeSearch  = false);

```

*Note : When you call the "search" method, il you don't provide a list of classnames as 4th parameter, the service will search in all entities indexed.*

How to index content
--------------------

[](#how-to-index-content)

### Manual indexing

[](#manual-indexing)

The bundle provides one service with two methods to index content.

The following method clears the index table and reindex all contents :

```
$this->get('it_search.database.indexer')->indexContent();
```

The second method update an object's index into the database :

```
$this->get('it_search.database.indexer')->updateIndex($object);
```

There is no method for removing a specific index from the database for now. The feature will be implemented soon.

### Automatic indexing

[](#automatic-indexing)

New feature since 1.3.0 is an EventListener that automatically create, update and remove indexes when you create, update or remove entities that at mapped by the indexer. As the listener is disabled by default, use this config to enable it :

```
# app/config/config.yml

it_search:
  enable_event_listener: true
  # ...
```

*Note : The listener is disabled by default to stay compatible with older versions of the bundle*

Events
------

[](#events)

Three event are dispatched during objects indexation :

- ITSearchEvents::PRE\_INDEX Dispatched at the beginning of the indexing.
- ITSearchEvents::PRE\_INDEX\_OBJECT Dispatched before indexing a specific object. The object is available in the event object.
- ITSearchEvents::POST\_INDEX Dispatched after indexing all objects. The SearchIndex objects list is available in the event object.

### Example of use

[](#example-of-use)

Here is an example of an All-in-one event subscriber :

```
// ACMEBundle\EventSubscriber\SearchEventSubscriber.php

use IT\SearchBundle\Event\ITSearchEvents;
use IT\SearchBundle\Event\SearchPostIndexEvent;
use IT\SearchBundle\Event\SearchPreIndexEvent;
use IT\SearchBundle\Event\SearchPreIndexObjectEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class SearchEventSubscriber implements EventSubscriberInterface
{

    public static function getSubscribedEvents()
    {

        return array(
            ITSearchEvents::PRE_INDEX           => 'preIndex',
            ITSearchEvents::PRE_INDEX_OBJECT    => 'preIndexObject',
            ITSearchEvents::POST_INDEX          => 'postIndex',
        );
    }

    public function preIndex(SearchPreIndexEvent $evt)
    {
        // Do stuff here
    }

    public function preIndexObject(SearchPreIndexObjectEvent $evt)
    {
        // Do stuff here
    }

    public function postIndex(SearchPostIndexEvent $evt)
    {
        // Do stuff here
    }

}
```

```

```

OR, in Yaml :

```
#services.yml

services:
  acme.search.subscriber:
    class: "ACMEBundle\EventSubscriber\SearchEventSubscriber"
    tags:
      - { name: "kernel.event_subscriber" }
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity65

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Recently: every ~3 days

Total

11

Last Release

3325d ago

Major Versions

0.9.1 → 1.0.02017-01-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/1414e4422c1b621f7e70def07c5d78286e4024d36df8b704dc3c50f30fb86750?d=identicon)[pierre-vassoilles](/maintainers/pierre-vassoilles)

### Embed Badge

![Health badge](/badges/it-search-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/it-search-bundle/health.svg)](https://phpackages.com/packages/it-search-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M465](/packages/pimcore-pimcore)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9417.2k58](/packages/open-dxp-opendxp)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
