Permalink
Fetching contributors…
Cannot retrieve contributors at this time
134 lines (98 sloc) 1.9 KB

UPGRADE FROM 2.x to 3.0

Package

The bundle has been renamed, be sure to change in your composer.json the name of the dependency:

Before:

"algolia/algolia-search-bundle"

After:

"algolia/search-bundle"

Bundle

Because of the bundle renaming, you need to update your AppKernel.php to

Before:

new Algolia\AlgoliaSearchBundle\AlgoliaAlgoliaSearchBundle(),

After:

new Algolia\SearchBundle\AlgoliaSearchBundle(),

Config

Before:

algolia:
    application_id: xxxxxx
    api_key: xxxxxxxxxxxxxxxxx

After:

algolia_search:
    indices:
        - name: posts
          class: App\Entity\Post

Note that if you previously had a prefix configured, you have to change the prefix:

Before:

algolia:
    prefix: foo

After:

algolia_search:
    prefix: foo_

The "Per environment indexing" was dropped. If you relied on this to separate your index (ex: prod vs dev) you need to apply this changes:

Before:

# the per environment indexing feature was enabled by default

After:

// config.yml
algolia_search:
    indices:
        - name: posts
          class: App\Entity\Post
// config_dev.yml
algolia_search:
    prefix: dev_

Mapping

The data is normalized using the Symfony Serializer component. You should read the documentation to learn how to create/use normalizer. Because of that change, you have to remove all @Algolia annotations you previously put on your entities.

Before:

/**
 * @ORM\Column(name="description", type="text")
 * @Algolia\Attribute
 */
protected $description;

After:

/**
 * @ORM\Column(name="description", type="text")
 */
protected $description;

Command

The indexation command has been renamed.

Before:

bin/console algolia:reindex

After:

bin/console search:import