You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm excited to try Meilisearch, so I'm happy there's a symfony bundle! Sadly the project I picked to try it out on uses Doctrine's Single Table Inheritance, and this confuses the meili:import command, or more specifically Services\MeiliSearchService::isSearchable().
Under Doctrine's single table inheritance method, we create multiple entity classes that inherit from a root entity in the normal PHP way (class MyEntityType extends BaseEntity…), and then a so-called discriminator column saves which type an entity really is, and Doctrine takes care of hydrating the right entity type when you load things from the parent type's repository. To give an example, I've got an app where I've got a Card entity, and its two subtypes are Article and Link. Both Article and Link have all the (searchable) properties of Card, but Articles have a content blob and Links have a URL to a site. With my previous search solution, I indexed Card so that I could search all cards together, which makes sense in this app -- the differences between the entities are in how they're displayed, not in what we browse and search for.
The problem seems to be that isSearchable() does a string comparison of entity class names against a list of configured classes, rather than using PHP's instanceof operator. This means that although all my entities are descendants of Card, they're actually Link or Article entities so isSearchable returns false and nothing ever gets into my index. If I configure each entity to have its own index, then… well they'd be in separate indices and not searchable as one thing, which is what I'd like to continue doing.
If I were to try to resolve this myself, I'd change the isSearchable method to do something like this
However I've not tested this, and I'm not familiar enough with the bundle or its uses to know if this could cause problems for other users, so I'm reluctant to submit a PR. If you think it's an acceptable change, I could try my hand at it though!
The text was updated successfully, but these errors were encountered:
Hello @inanimatt!
Thanks for your feedback and sorry for the delay!
I'm from the Meili team and I'm responsible for the integration repositories like this one. However, I'm not a Symfony user, so I'm not able to tell you how it could impact the usage of the other users, I mean if your suggestion is what they would like or if it's already what they expect.
This repository was built by an external contributor and he copied the Algolia's search bundle to adapt it to MeiliSearch. So the isSearchable method has currently the same behavior as the one in Algolia's search bundle.
But we are opensource, and it does not mean we cannot change it, that's why I particularly like this kind of issue 🙂
You can understand I cannot change it soon since you are the only one (for the moment) asking for this change, but I let this issue opened so that every user can come and share their opinion about it. We could make a decision together about this behavior 🙂
I'm excited to try Meilisearch, so I'm happy there's a symfony bundle! Sadly the project I picked to try it out on uses Doctrine's Single Table Inheritance, and this confuses the
meili:import
command, or more specificallyServices\MeiliSearchService::isSearchable()
.Under Doctrine's single table inheritance method, we create multiple entity classes that inherit from a root entity in the normal PHP way (
class MyEntityType extends BaseEntity…
), and then a so-called discriminator column saves which type an entity really is, and Doctrine takes care of hydrating the right entity type when you load things from the parent type's repository. To give an example, I've got an app where I've got a Card entity, and its two subtypes are Article and Link. Both Article and Link have all the (searchable) properties of Card, but Articles have a content blob and Links have a URL to a site. With my previous search solution, I indexed Card so that I could search all cards together, which makes sense in this app -- the differences between the entities are in how they're displayed, not in what we browse and search for.The problem seems to be that
isSearchable()
does a string comparison of entity class names against a list of configured classes, rather than using PHP'sinstanceof
operator. This means that although all my entities are descendants of Card, they're actually Link or Article entities soisSearchable
returns false and nothing ever gets into my index. If I configure each entity to have its own index, then… well they'd be in separate indices and not searchable as one thing, which is what I'd like to continue doing.If I were to try to resolve this myself, I'd change the isSearchable method to do something like this
However I've not tested this, and I'm not familiar enough with the bundle or its uses to know if this could cause problems for other users, so I'm reluctant to submit a PR. If you think it's an acceptable change, I could try my hand at it though!
The text was updated successfully, but these errors were encountered: