Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/compiler/PhutilSearchQueryCompiler.php
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | foreach ($tokens as $token) { | ||||
// See T12995. If this query term contains Chinese, Japanese or | // See T12995. If this query term contains Chinese, Japanese or | ||||
// Korean characters, treat the term as a substring term by default. | // Korean characters, treat the term as a substring term by default. | ||||
// These languages do not separate words with spaces, so the term | // These languages do not separate words with spaces, so the term | ||||
// search mode is normally useless. | // search mode is normally useless. | ||||
if (phutil_utf8_is_cjk($value)) { | if (phutil_utf8_is_cjk($value)) { | ||||
$use_substring = true; | $use_substring = true; | ||||
} else if (phutil_preg_match('/^_/', $value)) { | } else if (phutil_preg_match('/^_/', $value)) { | ||||
// See T13632. Assume users searching for any term that begins | // See T13632. Assume users searching for any term that begins | ||||
// with an undescore intend to perform substring search if they | // with an underscore intend to perform substring search if they | ||||
// don't provide an explicit search function. | // don't provide an explicit search function. | ||||
$use_substring = true; | $use_substring = true; | ||||
} | } | ||||
} | } | ||||
if ($use_substring) { | if ($use_substring) { | ||||
$operator = self::OPERATOR_SUBSTRING; | $operator = self::OPERATOR_SUBSTRING; | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0