16 import(
'lib.pkp.classes.search.SearchFileParser');
17 import(
'lib.pkp.classes.search.SearchHTMLParser');
18 import(
'lib.pkp.classes.search.SearchHelperParser');
20 define(
'SEARCH_STOPWORDS_FILE',
'lib/pkp/registry/stopwords.txt');
23 define(
'SEARCH_KEYWORD_MAX_LENGTH', 40);
37 if (is_array($text)) $text = join(
"\n", $text);
52 foreach ($words as $k) {
53 if (!isset($stopwords[$k]) &&
PKPString::strlen($k) >= $minLength && !is_numeric($k)) {
66 static $searchStopwords;
68 if (!isset($searchStopwords)) {
70 $searchStopwords = array_count_values(
72 array_map(
'trim', file(SEARCH_STOPWORDS_FILE)),
74 return !empty($a) && $a[0] !=
'#';
78 $searchStopwords[
''] = 1;
81 return $searchStopwords;