Closed wlasnapl closed 3 years ago
Can you point me to the line that can caused that problem here: https://github.com/algolia/search-bundle/compare/4.0.0...4.1.0 ?
@nunomaduro sorry for misleading. It was in the 4.1.0 code. I've updated description to point real issue. It looks like you forgot that you have aggregators function to handle also :)
@nunomaduro Is this bug going to be fixed?
@chloelbn do you think you can take a look at this next week?
@wlasnapl I tried to reproduce your issue on my end but everything looks fine. Are you only using aggregators and no entities? Did you make sure that in your Aggregator class the getEntities
method returns the classes you wish to add? Did you register your aggregator in the algolia_search.yml
file? Any code snippets would be appreciated to better understand what could be going on! Thanks a lot
@chloelbn The problem occurs especially if one of the entities to be aggregated does not have a configuration for its own index.
Using the example of the documentation: https://www.algolia.com/doc/framework-integration/symfony/advanced-use-cases/multiple-models-in-one-index/?language=php
If there is no configuration for a dedicated index in algolia_search.yml
for the entity Comment::class
, only objects for the entity Post::class
are published.
So you are forced to index the data twice, even if only the index with the aggregated objects is needed.
With the help of the repository, based upon the example of the documentation, https://github.com/MaSpeng/algolia-search-bundle-aggregator-issue-337 the behaviour can be easily traced.
@chloelbn Did you have any chance to check the issue against the example repository i provided?
Description
Aftere upgrade to 4.1.0 indexing aggregators is broken. After revert to 4.0.0 everything is working fine. It looks like that this part of code in SearchImportCommand is to blame: https://github.com/algolia/search-bundle/blob/6714243a8eb87153b68a4efdb94c7d7349f60eda/src/Command/SearchImportCommand.php#L90-L92 Because $entityClassName is changed before from Agreggator class to Entity class and isSearchable is looking in array where is only Aggregator. Without this condition this method is also failing on this line: https://github.com/algolia/search-bundle/blob/6714243a8eb87153b68a4efdb94c7d7349f60eda/src/Command/SearchImportCommand.php#L96 Because of the same reason: indice is assigned to Aggregator class not entity.
Steps To Reproduce
1) create aggregator with multiple entities 2) run search:import 3) nothing happens. There are no messages: "Indexed A/B CLASS entities into INDEX". But there is message "Done!". Nothing changes in index.