PHPackages                             doctrine/search - 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. [Database &amp; ORM](/categories/database)
4. /
5. doctrine/search

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

doctrine/search
===============

ElasticSearch and Solr entity mapping library

v0.2(9y ago)27558.7k↑31.8%50[10 issues](https://github.com/doctrine/search/issues)[1 PRs](https://github.com/doctrine/search/pulls)MITPHPPHP &gt;=5.3.2

Since Dec 29Pushed 8y ago5 watchersCompare

[ Source](https://github.com/doctrine/search)[ Packagist](https://packagist.org/packages/doctrine/search)[ Docs](https://github.com/doctrine/search)[ RSS](/packages/doctrine-search/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (7)Used By (0)

Doctrine Search
===============

[](#doctrine-search)

Note: This project is a prototype at the moment. See `demo` folder for practical implementation example.

**Supported search engines**

- [ElasticSearch](http://www.elasticsearch.org/) (functional)
- [Solr](http://lucene.apache.org/solr/) (partial implementation)

**Features**

- SearchManager
    - Can be used stand-alone or in a hybrid configuration
    - Configurable search manager supports aggregate entity manager
    - supports direct API calls through search engine adapters such as Elastica
    - transforms returned ID's via batch operation into hydrated objects as required
    - Supports event manager listeners for customizable entity handling
- Support for indexing through event listeners via JMS Serializer or simple entity callback.
- Annotations for index and data type creation using ObjectManager::getClassMetadata() as the base structure

\#Usage#

Configuration
-------------

[](#configuration)

The search manager connection can be configured as shown in the following example:

```
$config = new Doctrine\Search\Configuration();
$config->setMetadataCacheImpl(new Doctrine\Common\Cache\ArrayCache());
$config->setEntitySerializer(
  new Doctrine\Search\Serializer\JMSSerializer(
    JMS\Serializer\SerializationContext::create()->setGroups('search')
  )
);

$eventManager = new Doctrine\Search\EventManager();
$eventManager->addListener($listener);

$searchManager = new Doctrine\Search\SearchManager(
  $config,
  new Doctrine\Search\ElasticSearch\Client(
    new Elastica\Client(array(
      array('host' => 'localhost', 'port' => '9200')
    )
  ),
  $eventManager
);
```

Mappings
--------

[](#mappings)

Basic entity mappings for index and type generation can be annotated as shown in the following example. Mappings can be rendered into a format suitable for automatically generating indexes and types using a build script (advanced setup required).

```
