massiveart/MassiveSearchBundle

Overriding search configuration does not work

Closed this issue · 10 comments

When i want to extend the e.g. SuluContactBundle:Account Entity with SuluContactExtensionBundle:Account by overriding the massive-search/Account.xml file, it does not have any impact.

The override attempt:
sulu/SuluContactExtensionBundle#18


Resulting from the following discussion:
sulu/sulu#1349

@chirimoya you want me to work on this?

@dantleech would be nice. Also we should talk about the security regarding the search results.

ok. will try and have a look today or tomorrow. Send me a mail about the
security.

On Tue, Jul 21, 2015 at 03:58:18AM -0700, Thomas Schedler wrote:

[1]@dantleech would be nice. Also we should talk about the security
regarding the search results.


Reply to this email directly or [2]view it on GitHub.

Reverse link: [3]unknown

References

Visible links

  1. https://github.com/dantleech
  2. #55 (comment)
  3. #55 (comment)

@turbo-ele I can't see where the problem is here, as you do not seem to be overriding the mapping for the entity - I think you are creating a new mapping for a new entity (ContactExtensionBundle\Entity\Account). So this should be no problems with this.

I have created a command to list the known metadata classes in this PR. Could you checkout that branch and run massive:search:metadata:debug to see if your new Entity is listed?

i will have a look at it today

You are right:

> app/console massive:search:metadata:debug
+---------------------------------------------------+--------+
| Class                                             | Status |
+---------------------------------------------------+--------+
| Sulu\Bundle\ContactBundle\Entity\Account          | ok     |
| Sulu\Bundle\ContactBundle\Entity\Contact          | ok     |
| Sulu\Bundle\MediaBundle\Entity\FileVersionMeta    | ok     |
| Sulu\Bundle\ContactExtensionBundle\Entity\Account | ok     |
+---------------------------------------------------+--------+

I was thought it should be replacing the account. but it's just indexing both account entities instead, which is fine.

thanks

Should both entities be indexed? I would not say so, but I guess that's an Sulu issue then, the configuration for the "old" entity should not be exposed to the SearchBundle.

I think it is fine that the other entity is mapped - it does no harm. The alternative would be to add the support for explicit mapping and then explicitly map the entity paths, but that is more effort in the long run.

Well, it uses more disk space than it have to, since in Sulu just one of both entities is used.

Oh yes, I think I see what you mean now. So in that case I am pretty sure it will NOT created two records. It will ask for the metadata for the persisted Entity and the best match will be returned and a single record will be stored.