Currently Search API doesn't work with multibyte string. The function createExcerpt() in includes/processor_highlight.inc uses the function stripos to match the keyword used, which is not compatible with MB strings. Using mb_stripos fixes this issue and makes highlighting work with mb strings.

Comments

kevineinarsson created an issue. See original summary.

kevineinarsson’s picture

Status: Active » Needs review
StatusFileSize
new596 bytes
kristofferwiklund’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

drunken monkey’s picture

Title: Multibyte String Highlighting » Multi-byte partial-match highlighting is not case-insensitive
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new672 bytes

Thanks a lot for reporting this issue and providing a patch!
Sorry I didn't respond earlier – this issue appears to have slipped through the cracks in my inbox. (I haven't figured out yet why this keeps happening now and again.) In the future, please feel free to ping me via mail, contact form or IRC when I don't reply to any new issue within a month or so.

Anyways, regarding the patch, it looks basically good, but will fail if someone runs PHP without the mbstring extension enabled (which is possible in Drupal). We'll have to check whether the function actually exists before using it.
Revised patch attached, please test whether it still works for you.

Status: Needs review » Needs work
drunken monkey’s picture

Component: General code » Plugins
Status: Needs work » Needs review
StatusFileSize
new669 bytes

Ooops …

drunken monkey’s picture

Status: Needs review » Fixed

Committed.
Thanks again!

Status: Fixed » Closed (fixed)

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

ciss’s picture

Sorry to be such a gravedigger, but wouldn't it be more efficient to test for, and store, the function name outside of the while loop instead of retesting in every single iteration?

Edit: Apparently this change got erased in 27b6cbb6f (#2990940: Excerpt is not shown when the indexed text is not in English).