Hello guys,

I use this module for a search on my site in conjunction with Search API DB as a server for custom entities and a custom view. In my Drupal logs there are messages like the following:

	Notice: Array to string conversion in SearchApiHighlight->postprocessSearchResults() (Line 132 of /sites/all/modules/search_api/includes/processor_highlight.inc).

The view listing the search results does not include excerpts - just the entity's fields. I had no time yet to go through the code so does anyone has an idea what could cause this messages to appear?

Best,
Tobias

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

Have you tried the latest dev release as well? Some highlighting processor issues were fixed since 1.11.

tobiberlin’s picture

Thank you for your reply... no I did not try the latest dev version - I simply deactivated the highlighting processor for my indexes as I do not really need it

bacardi55’s picture

Hi,

I still have the issue after upgrading to the search_api-7.x-1.x-dev version.

I'm using search_api_elasticsearch, not sure if the issue come from a difference between search_api_elasticsearch and search_api_solr.
In any case, I wrote that patch that fix the issue (at least in my use case).

Please let me know if you have comment/remarks or idea to improve the patch

drunken monkey’s picture

Thanks for providing a patch!
Might be that the Elastic Search module you're using returns the field values in a weird format – i.e., a multi-dimensional array (instead of, at most, a normal array of strings). Please investigate whether that might not be the issue.

But otherwise, I guess this patch could also make sense. Looks good, thanks!

fabianderijk’s picture

Version: 7.x-1.11 » 7.x-1.12
Status: Active » Needs review
FileSize
2.35 KB

I've just updated this patch to also fix the Warning: preg_split() expects parameter 2 to be string, array given in SearchApiHighlight->highlightField() warning.

Status: Needs review » Needs work

The last submitted patch, 5: search_api-excerpt-notices-2216345-5.patch, failed testing.

drunken monkey’s picture

Version: 7.x-1.12 » 7.x-1.x-dev
Component: Framework » Plugins
Status: Needs work » Fixed

Looks good, thanks!
Committed.

  • Commit c3206ec on 7.x-1.x authored by bacardi55, committed by drunken monkey:
    Issue #2216345 by bacardi55, fabianderijk, drunken monkey: Fixed array...

Status: Fixed » Closed (fixed)

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