This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » eZ Publish 5 Platform » Searching for data by object relation?

Searching for data by object relation?

Searching for data by object relation?

Thursday 25 April 2013 9:55:23 am - 5 replies


I'm currently trying to pull data from the repository using the search service but I'm having issues searching on an object relation.

For the following example how would it be possible to retrieve the locations from the database?

Item Class:

Title - Single Line Input
Description - Multi Line Input
Locations - Objects Relations - Location Class (Multi-select)

Location Class
Title - Single Line Input
Location Code - Single Line Input

How would it be possible to return a list of objects using the search service that have a specific location code?

Thursday 25 April 2013 10:28:35 am

Try loadReverseRelations, you will get the objects that have a relation to you Location object.

But you will get all the objects that have a relation, there is currently no specific filter as in the old version (

Hope this will be hepfull.

Thursday 25 April 2013 11:49:27 am

So at the moment there is no way to use the search service to return objects by searching on a related field?

I'm currently building a site which will have ~40,000 objects and need to be able to search for an object based on its relations, loading everything in would surely be far too memory intensive to perform an anywhere near a decent level.

Is the only way to do this writing a custom query and then passing each result through to loading the specific content id?

Thursday 25 April 2013 12:00:34 pm

(sorry, I was answering on the wrong post)

Modified on Thursday 25 April 2013 12:01:30 pm by Jérôme Vieilledent

Wednesday 01 May 2013 12:49:14 pm


Is this possible to do with 4.* legacy code? Surely there must be a way to search on a related field?


Wednesday 01 May 2013 7:12:00 pm

In 4.x, you can tag any relation as searchable or not.

If a relation is searchable, when seraching for "xxx", you will find both the object which has that string and the objects which relate to him (it is easy to see when you use the ezfind control panel)


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from