contao/test — Issue #2769: A hook for creating efficient search index on some languages
Author: taca
Created: 2011-11-29 10:16:47+00:00
State: open
Labels: Accepted, Feature, framework

Hi,

As far as I understand, Contao's serch function assumes that each word are separated by space. It is true for latin languages but not on some asian languages including Japanese. I found some codes in system/libraries/Search.php (about line 232 of commit:55402d485124f58ff8b81257d33d575c), indexPage() function in Search class:

```
// Split words
$arrWords = preg_split('/ +/', utf8_strtolower($strText));
$arrIndex = array();
```

If this preg_split() could relaced with different one by hook function, it would be possible to write the external module which splits words in Japanese efficiently.
(Such an external module needs to use morphological analysis methods and it isn't appropriate to include such function in Contao core.)

This might not enough with this single hook, but I think it would be better results.

Best regards.

--- _Originally created on January 6th, 2011, at 12:09pm (ID 2769)_