Changeset View
Changeset View
Standalone View
Standalone View
src/search/PhutilSearchStemmer.php
| Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | private function applyStemmer($normalized_token) { | ||||
| // sorts of informal tokens. | // sorts of informal tokens. | ||||
| if (preg_match('/[._]/', $normalized_token)) { | if (preg_match('/[._]/', $normalized_token)) { | ||||
| return $normalized_token; | return $normalized_token; | ||||
| } | } | ||||
| static $loaded; | static $loaded; | ||||
| if ($loaded === null) { | if ($loaded === null) { | ||||
| $root = dirname(phutil_get_library_root('phutil')); | $root = dirname(phutil_get_library_root('arcanist')); | ||||
| require_once $root.'/externals/porter-stemmer/src/Porter.php'; | require_once $root.'/externals/porter-stemmer/src/Porter.php'; | ||||
| $loaded = true; | $loaded = true; | ||||
| } | } | ||||
| $stem = Porter::stem($normalized_token); | $stem = Porter::stem($normalized_token); | ||||
| // If the stem is too short, it won't be a candidate for indexing. These | // If the stem is too short, it won't be a candidate for indexing. These | ||||
| Show All 10 Lines | |||||