Search code examples
sulu

Sulu: Including custom entity in admin search


While evaluating Sulu (read: I’m a Sulu newbie), I added a custom entity. In the entity’s list XML configuration I used searchability="yes" on some properties, which works for defining which properties are used for filtering the list of entities.

But (other than I would have expected) this attribute does not have any effect on the global admin search. So my question ist: how can I achieve that my custom entities are found in the global Sulu admin search?

I did not find any information on this in the cookbook nor in the sulu-demo repository.


Solution

  • As you have already noticed, the properties in the list configuration are used only for displaying the list in the administration interface. The list configuration is separated from the global search functionality.

    The search functionality of the administration interface is implemented by the SuluSearchBundle. It builds upon another bundle called the MassiveSearchBundle. If you want to integrate your custom entity with the global search functionality, you need to do two things:

    1. Configure the MassiveSearchBundle to index the data of your custom entity. The MassiveSearchBundle documentation should explain how to do this.
    2. Register the index in the SuluSearchBundle to make it searchable via the administration interface. This step is described in the Sulu documentation.