I configured a vocabulary to be indexed "hierarchically, with parent terms". On indexing (with drush) I receive the following error message:

WD php: EntityMetadataWrapperException: Unable to get the data property parent as the parent data     [error]
structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442 of
/var/web/drupal/d7contrib/entity/includes/entity.wrapper.inc).
EntityMetadataWrapperException: Unable to get the data property parent as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (Zeile 442 von /var/web/drupal/d7contrib/entity/includes/entity.wrapper.inc).
  • When I disable the indexing with parent terms, the error goes away and indexing works as usual.
  • When I choose to include "all parent terms", not just the imminent parent, PHP throws a segmentation fault and drush dumps a "core"-file/memory-dump (allowed memory for php: 512MB - fastcgi: 1GB - shouldn't be the problem here).

I'm using search_api and search_api_solr.

Any ideas? I really need parent terms to be indexed for a a browsing interface which heavily relies on facets.

Comments

jsacksick’s picture

Are you using the latest dev version ? Because this issue should be resolved ?

Anonymous’s picture

I'm using this version of search_api:

7.x-1.x-dev - 2012-Mar-26

This is the drush output of all the search related modules I've installed:

Search                  Old search facets (deprecated)                 Module  Not installed  7.x-1.0+1-dev  
                         (search_api_facets)                                                                  
 Search                  Search API (search_api)                        Module  Enabled        7.x-1.0+1-dev  
 Search                  Search API attachments                         Module  Not installed  7.x-1.2        
                         (search_api_attachments)                                                             
 Search                  Search API autocomplete                        Module  Enabled        7.x-1.x-dev    
                         (search_api_autocomplete)                                                            
 Search                  Search facets (search_api_facetapi)            Module  Enabled        7.x-1.0+1-dev  
 Search                  Search pages (search_api_page)                 Module  Enabled        7.x-1.0-beta2  
 Search                  Search spellcheck (search_api_spellcheck)      Module  Not installed  7.x-1.0        
 Search                  Search views (search_api_views)                Module  Enabled        7.x-1.0+1-dev  
 Search                  Solr search (search_api_solr)                  Module  Enabled        7.x-1.0-rc1+4- 

Also, my entity bundle:

Other                   Entity API (entity)                            Module  Enabled        7.x-1.0-rc1+46 -dev           
Other                   Entity tokens (entity_token)                   Module  Enabled        7.x-1.0-rc1+46-dev           

I'm happy to provide you with any kind of info you need, just tell me what you need and I'll collect it.

drunken monkey’s picture

Can you index normally, without drush?
Also, I vaguely recall some problems when not choosing "all parent terms" there – maybe that's the issue. The segfault should be reported as a PHP bug (or you could test whether a newer version of PHP fixes this issue, if possible), those can never be an application's fault.
Also try to ask around in the Entity API issue queue (are you using the latest version of that module?) whether the error looks familiar to someone. It's possible that the problem lies there, and not in the Search API.

Anonymous’s picture

Thanks for your reply. I worked around this problem and didn't look into it after I found a way to get the functionality I wanted using a combination of search API and Views-based Taxonomy (child/parent selection). I could therefore avoid indexing hierarchies, but still get selections based on relationships.

I think (with my limited understanding of the problem, anyways) that it is a problem happening at entity API and has nothing to do with search API in particular. Indexing fails only for a number of nodes where something fishy is going on with terms, but I didn't had the resources to investigate any further as I wasn't able to find out at which node and why exactly entity API failed to deal with relationships.

However, there seem to be a couple of known problems over at entity API which have to do with term's parent/child selections failing if terms are altered/deleted. The indexing failed on both ends btw, CLI and via search API UI.

gaëlg’s picture

This happens when the taxonomy field contains a tid of a term which does not exist anymore.

gaëlg’s picture

Status: Active » Needs review

In search_api/includes/callback_add_hierarchy.inc
Replace line 235:
if (!$v || !isset($wrapper->$property) || !$wrapper->$property->value()) {
with
if (!$v || !$wrapper->value() || !isset($wrapper->$property) || !$wrapper->$property->value()) {

Anonymous’s picture

The code changed meanwhile and I still get the same error in the latest minor version and dev version. In order to get it to work, replace the following code in the latest dev:

search_api/includes/callback_add_hierarchy.inc (line: 237)

-- if (isset($wrapper->$property) && $wrapper->$property->value()) {
++ if ($wrapper->value() && isset($wrapper->$property) && $wrapper->$property->value()) {

However, I'm not sure if this is the right way to fix this issue or if it just prevents the display of an error. I will test my index and my views.

Anonymous’s picture

This issue has been duplicated over here: http://drupal.org/node/1594762

There's a patch available, you might wanna give this a try.

legolasbo’s picture

Issue summary: View changes
Status: Needs review » Closed (duplicate)