EntityMetadataWrapperException: Unable to get the data property field_languages_level as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 396 of /var/www/fago/web/recruiter/profiles/recruiter/modules/entity/includes/entity.wrapper.inc).

Probably Search API should just catch that exception.

Comments

drunken monkey’s picture

Title: error upon indexing » Error upon indexing

Since the error doesn't occur here: could you tell me, where in the Search API the exception occurs? In search_api_extract_fields(), which does the heavy lifting for extracting the data from the indexed items, all exceptions should be caught.

drunken monkey’s picture

Status: Active » Fixed

If the issue is still present, please re-open with additional information.

fago’s picture

Status: Fixed » Active

Yep, it still appears. I tracked it down to search_api_extract_fields(). The tricky thing is it appears when iterating over a wrapper, as iterating over a list needs to fetch the values to determine the keys, it can cause an exception. So best, just catch the EntityMetadataWrapperException for the whole function.

fago’s picture

Title: Error upon indexing » Error upon indexing not accessible properties
Status: Active » Needs review
StatusFileSize
new4.42 KB

attached patch fixes it for me.

fago’s picture

StatusFileSize
new4.44 KB

Probably we should always return an array though.

fago’s picture

StatusFileSize
new1.78 KB

hm, that patch caused troubles when some values where empty. Improved variant attached.

drunken monkey’s picture

Thanks for the patch!
Just to clarify: the error occurs when the given $wrapper is of a list type, but with NULL (or another non-array) as the value? Or when it is a list with a somehow faulty or inaccessible element?

fago’s picture

Component: Code » Framework

I think it occurs if the value for the list itself cannot be loaded, thus causing an exception directly in

foreach ($list_wrapper as $item)

drunken monkey’s picture

Title: Error upon indexing not accessible properties » Error upon indexing inaccessible list properties
Status: Needs review » Fixed

OK, then there really doesn't seem to be anything else we can do.
Committed your last patch, thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.