Skip to content

Commit 81a13ed

Browse files
committedNov 17, 2014
Search Typeahead - make exact matches show up first
Summary: Fixes T6102. Give "priority" treatment to strings that are exact matches. Test Plan: made a bunch of projects with the word project in them including "Project". before patch, "Project" wouldn't even show up if I typed "Project" - now its the second result right after the application "Projects". {F235120} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6102 Differential Revision: https://secure.phabricator.com/D10867
1 parent dc1106a commit 81a13ed

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed
 

‎resources/celerity/map.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
return array(
99
'names' => array(
1010
'core.pkg.css' => '0784ef1d',
11-
'core.pkg.js' => 'cbdbd552',
11+
'core.pkg.js' => 'e5f7f2ba',
1212
'darkconsole.pkg.js' => 'df001cab',
1313
'differential.pkg.css' => '8af45893',
1414
'differential.pkg.js' => '42c10e78',
@@ -481,7 +481,7 @@
481481
'rsrc/js/core/behavior-remarkup-preview.js' => 'f7379f45',
482482
'rsrc/js/core/behavior-reorder-applications.js' => '76b9fc3e',
483483
'rsrc/js/core/behavior-reveal-content.js' => '60821bc7',
484-
'rsrc/js/core/behavior-search-typeahead.js' => 'd712ac5f',
484+
'rsrc/js/core/behavior-search-typeahead.js' => '724b1247',
485485
'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6',
486486
'rsrc/js/core/behavior-toggle-class.js' => 'e566f52c',
487487
'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884',
@@ -622,7 +622,7 @@
622622
'javelin-behavior-phabricator-oncopy' => '2926fff2',
623623
'javelin-behavior-phabricator-remarkup-assist' => 'e32d14ab',
624624
'javelin-behavior-phabricator-reveal-content' => '60821bc7',
625-
'javelin-behavior-phabricator-search-typeahead' => 'd712ac5f',
625+
'javelin-behavior-phabricator-search-typeahead' => '724b1247',
626626
'javelin-behavior-phabricator-show-all-transactions' => '7c273581',
627627
'javelin-behavior-phabricator-tooltips' => '3ee3408b',
628628
'javelin-behavior-phabricator-transaction-comment-form' => '9f7309fb',
@@ -1278,6 +1278,16 @@
12781278
'phabricator-phtize',
12791279
'changeset-view-manager',
12801280
),
1281+
'724b1247' => array(
1282+
'javelin-behavior',
1283+
'javelin-typeahead-ondemand-source',
1284+
'javelin-typeahead',
1285+
'javelin-dom',
1286+
'javelin-uri',
1287+
'javelin-util',
1288+
'javelin-stratcom',
1289+
'phabricator-prefab',
1290+
),
12811291
'7319e029' => array(
12821292
'javelin-behavior',
12831293
'javelin-dom',
@@ -1733,16 +1743,6 @@
17331743
'javelin-stratcom',
17341744
'javelin-dom',
17351745
),
1736-
'd712ac5f' => array(
1737-
'javelin-behavior',
1738-
'javelin-typeahead-ondemand-source',
1739-
'javelin-typeahead',
1740-
'javelin-dom',
1741-
'javelin-uri',
1742-
'javelin-util',
1743-
'javelin-stratcom',
1744-
'phabricator-prefab',
1745-
),
17461746
'd75709e6' => array(
17471747
'javelin-behavior',
17481748
'javelin-workflow',

‎webroot/rsrc/js/core/behavior-search-typeahead.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,19 @@ JX.behavior('phabricator-search-typeahead', function(config) {
6262
var ii;
6363
for (ii = 0; ii < list.length; ii++) {
6464
var item = list[ii];
65+
66+
for (var jj = 0; jj < tokens.length; jj++) {
67+
if (item.name.indexOf(tokens[jj]) === 0) {
68+
priority_hits[item.id] = true;
69+
}
70+
}
71+
6572
if (!item.priority) {
6673
continue;
6774
}
6875

69-
for (var jj = 0; jj < tokens.length; jj++) {
70-
if (item.priority.substr(0, tokens[jj].length) == tokens[jj]) {
76+
for (var hh = 0; hh < tokens.length; hh++) {
77+
if (item.priority.substr(0, tokens[hh].length) == tokens[hh]) {
7178
priority_hits[item.id] = true;
7279
}
7380
}

0 commit comments

Comments
 (0)
Failed to load comments.