@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Identify compound short search tokens in the form "xx.yy" as unqueryable in the search UI

Summary:
Ref T12928. The index doesn't work for these, so show the user that there's a problem and drop the terms.

This doesn't fix the problem, but makes the behavior more clear.

Test Plan:
{F5053703}

{F5053704}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12928

Differential Revision: https://secure.phabricator.com/D18254

+19 -1
+19 -1
src/applications/search/fulltextstorage/PhabricatorMySQLFulltextStorageEngine.php
··· 235 235 $value = $stemmer->stemToken($value); 236 236 } 237 237 238 - if (phutil_utf8_strlen($value) < $min_length) { 238 + if ($this->isShortToken($value, $min_length)) { 239 239 $fulltext_token->setIsShort(true); 240 240 continue; 241 241 } ··· 547 547 $stopwords = array_fuse($stopwords); 548 548 549 549 return array($min_len, $stopwords); 550 + } 551 + 552 + private function isShortToken($value, $min_length) { 553 + // NOTE: The engine tokenizes internally on periods, so terms in the form 554 + // "ab.cd", where short substrings are separated by periods, do not produce 555 + // any queryable tokens. These terms are meaningful if at least one 556 + // substring is longer than the minimum length, like "example.py". See 557 + // T12928. 558 + 559 + $parts = preg_split('/[.]+/', $value); 560 + 561 + foreach ($parts as $part) { 562 + if (phutil_utf8_strlen($part) >= $min_length) { 563 + return false; 564 + } 565 + } 566 + 567 + return true; 550 568 } 551 569 552 570 }