I have been trying to get search api attachments working in a clean install of Drupal 7.23.

I tried the stable release 1.3, but has the same error, so tried the dev release.

It is throwing the following error and not indexing the attachment. I see that tika must be running as the cache_search_api_attachment data field BLOB has the extracted text, but nothing is getting pushed to my solr server related to the attachment. It is showing the following entry in the log:

Notice: Undefined property: stdClass::$attachments_field_asset in SearchApiAttachmentsAlterSettings->alterItems() (line 39 of /www/sites/all/modules/search_api_attachments/includes/callback_attachments_settings.inc).

I poked around and I can't even find a reference to attachments_field_asset anywhere in any of search_api and related modules.

I would appreciate any assistance that can be provided.

Comments

izus’s picture

Maybe in admin/config/search/search_api/index/MY_INDEX/fields, there is a attachments_field_asset that should be checked ?

izus’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

Updating status and category

izus’s picture

Title: Notice: Undefined property: stdClass::$attachments_field_asset in SearchApiAttachmentsAlterSettings->alterItems() (line 39 of /www/sites/all/modules/search_api_attachments/includes/callback_attachments_settings.inc). » Notice: Undefined property in SearchApiAttachmentsAlterSettings->alterItems()

also changing title

cmkeane’s picture

Yes, the attachments_field_asset is checked and listed as Fulltext.

cmkeane’s picture

Interestingly, I went to an existing server where I DO have search attachments working properly (v 1.3) and interfacing with the same solr server (different core). The only difference is the working server has php 5.3 while the non-working one has php 5.5. Other than that I am not finding any material differences in the configurations. Is PHP version potentially an issue?

izus’s picture

hmm, weird...i don't know if other people that use php5.5 have the same trouble (i'm using 3.5).
Did you success to find the line code to blame ? a php syntax that evaluates on 5.3 but not on 5.5 ?
Thanks for your investigations :)

cmkeane’s picture

This had me totally stumped. I never could isolate it. I did a completely clean install on another instance (this one using PHP 5.4) to meet deadline and it worked properly. I have the old config and when I get a chance, I will poke around more at it and add more info here then.

thepanz’s picture

After some investigations, the reason of this issue looks like the one at https://drupal.org/node/2050775 : in PHP 5.5 something has changed in the way properties are handled.

My working code (edit line 39 of callback_attachments_settings.inc) is the following:

                  if (isset($item->{$attachments})) {
                    $item->{$attachments} .= self::getFileContent($file);
                  }
                  else {
                    $item->{$attachments} = ' ' . self::getFileContent($file);
                  }
thepanz’s picture

Category: Support request » Bug report
Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Active
thepanz’s picture

StatusFileSize
new931 bytes
thepanz’s picture

Status: Active » Needs review
garrettc’s picture

I can confirm that this patch fixes the issue on PHP 5.5.7.

izus’s picture

Hi
thanks for the patch.
I added it also for the submodule search_api_attachments_field_collections
i will merge it soon

izus’s picture

Status: Needs review » Fixed

last patch is merged to 7.x-1.x
Thanks all

Status: Fixed » Closed (fixed)

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