Hello,

Search API requires hook_entity_property_info , so fields in referenced nodes can be properly indexed together with the referrring node fields (some issues:
#1118282: Node reference integration and http://drupal.org/project/issues/search_api?text=hook_entity_property_in... ).

I grepped the current entityreference code but have not found hook_entity_property_info .

Comments

giorgio79’s picture

Issue summary: View changes

dfgdf

damien tournoud’s picture

Status: Active » Postponed (maintainer needs more info)

We are properly integrated with the Entity Metadata API (see entityreference_field_property_callback() referenced into entityreference_field_info()), and this integration is definitely working.

Any specific feature request here?

giorgio79’s picture

Thanks Damien.

In short: In a search view, currently it is not possible to use facetapi blocks for fields in referenced nodes for some reason, and I have yet to find a solution.

High level example with 2 content types:
1 content type: school (with address field for example)
1 content type: teacher, with entity reference for school

It would be great to filter teachers based on fields in school, but facet blocks for school fields do not show for a search view if it includes only teachers. (even if searvc view has a relationship defined for school).

For example if school has an address field, it would be great to use school's address field facets for teachers, as if they would belong to the teacher entity.

Also tried to discuss this with cpliakas but he says this has to do with the way search api indexes entities: #1626478: Ability to use facet for a referenced entity?

damien tournoud’s picture

That should work out of the box. I assume you are indexing teachers, and that's what you want to display. Then you need to add the fields of the school you want to filter / facet by in the index (*not* in the view). You will find them by adding the proper relation at the bottom of the "Field" tab of the index.

giorgio79’s picture

Yep, tried a couple of times. I even have the facet available.

Will try to create a new index to test.

giorgio79’s picture

I managed to narrow the issue down a bit, and I believe it is a Search API issue:
#1661514: Hierarchical taxonomy unavailable through referenced entity
Essentially, hierarchical taxonomies do not seem to be available for referenced entities in Search API.

damien tournoud’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Ok, I'm going to assume the issue is somewhere else.

giorgio79’s picture

Yep, thanks. I was just about to close it. :) Looks like it is somewhere in search api or search api db.

giorgio79’s picture

Issue summary: View changes

ioiopiop