@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.

Tokenize datasource indexes on "(" and ")"

Summary:
Fixes T11955. Milestone names are currently tokenizing and indexing awkwardly. For example, "A (B C D)" becomes the tokens "A", "(B", "C" and "D)".

The token "(B" can't be searched for since "(" is tokenized on the client.

Instead, tokenize "A (B C D)" into "A", "B", "C", "D".

Test Plan:
- Added unit tests.
- Used `bin/search index --type project --force` to reindex.
- Searched for "A", "B", "C", "D", etc., for real examples.
- Now, found milestones more consistently.
- Also serached for `viewer()`, `members()`, etc.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11955

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

+15 -1
+3 -1
src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php
··· 141 141 return array(); 142 142 } 143 143 144 - $tokens = preg_split('/[\s\[\]-]+/u', $string); 144 + // NOTE: Splitting on "(" and ")" is important for milestones. 145 + 146 + $tokens = preg_split('/[\s\[\]\(\)-]+/u', $string); 145 147 $tokens = array_unique($tokens); 146 148 147 149 // Make sure we don't return the empty token, as this will boil down to a
+12
src/applications/typeahead/datasource/__tests__/PhabricatorTypeaheadDatasourceTestCase.php
··· 27 27 $this->assertTokenization( 28 28 '[[ brackets ]] [-] ]-[ tie-fighters', 29 29 array('brackets', 'tie', 'fighters')); 30 + 31 + $this->assertTokenization( 32 + 'viewer()', 33 + array('viewer')); 34 + 35 + $this->assertTokenization( 36 + 'Work (Done)', 37 + array('work', 'done')); 38 + 39 + $this->assertTokenization( 40 + 'A (B C D)', 41 + array('a', 'b', 'c', 'd')); 30 42 } 31 43 32 44 private function assertTokenization($input, $expect) {