cebe\jssearch\tokenizer\StandardTokenizer::tokenizeJs PHP Method

tokenizeJs() public method

This is used to ensure the same tokenizer is used for building the index and for searching.
public tokenizeJs ( ) : string
return string
    public function tokenizeJs()
    {
        $delimiters = preg_quote($this->delimiters, '/');
        $stopWords = json_encode($this->stopWords);
        return <<<JS
function(string) {
\t\tvar stopWords = {$stopWords};
\t\treturn string.split(/[\\s{$delimiters}]+/).map(function(val) {
\t\t\treturn val.toLowerCase();
\t\t}).filter(function(val) {
\t\t\tfor (w in stopWords) {
\t\t\t\tif (stopWords[w] == val) return false;
\t\t\t}
\t\t\treturn true;
\t\t}).map(function(word) {
\t\t\treturn {t: word, w: 1};
\t\t});
}
JS;
    }
StandardTokenizer