Define aggregators
To create a new aggregator, add a new class to your entities directory. ThegetEntities method of this class should return all the entity classes you want to index:
PHP
Algolia\SearchBundle\Document\Aggregator class instead.
Finally, add the new aggregator class name to the config/packages/algolia_search.yaml file:
YAML
Search
An aggregator is a standard entity class. To start searching entities on the aggregator, use thesearch method of your
SearchService:
PHP
rawSearch method.
However, each result might have a different structure:
PHP
JSON
normalize method
on each entity or override it on the aggregator class.
Conditional indexing
Conditional indexing on aggregators works just like a normal entity, using theindex_if key.
Use $this->entity to have access to the current entity being aggregated.
Here is an example using the method approach:
YAML
PHP