Skip to content

Commit f13709b

Browse files
author
epriestley
committedApr 14, 2019
Update search indexes for Dashboards and Panels to Ferret, plus various minor fixes
Summary: Depends on D20410. Ref T13272. Dashboards/Panels currently use older "ngram" indexing, which is a less-powerful precursor to Ferret. Throw away the ngram index and provide a Ferret index instead. Also: - Remove the NUX state, which links to the wrong place now and doesn't seem terribly important. - Add project tags to the search result list. - Make the "No Tags" tag a little less conspicious. Test Plan: - Indexed dashboards and panels. - Searched for dashboards and panels via SearchEngine using Ferret "query" field. - Searched for panels via "Add Existing Panel" datasource typeahead. - Searched for dashboards via "Add Menu Item > Dashboard" on a ProfileMenu via typeahead. - Viewed dashboard NUX state (no special state, but no more bad link to "/create/"). - Viewed dashboard list, saw project tags. - Viewed dashboards with no project tags ("No Tags" is now displayed but less visible). Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13272 Differential Revision: https://secure.phabricator.com/D20411
1 parent 80b7274 commit f13709b

29 files changed

+228
-120
lines changed
 

‎resources/celerity/map.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'names' => array(
1010
'conpherence.pkg.css' => '3c8a0668',
1111
'conpherence.pkg.js' => '020aebcf',
12-
'core.pkg.css' => '4011a01e',
12+
'core.pkg.css' => '77c4f199',
1313
'core.pkg.js' => '69247edd',
1414
'differential.pkg.css' => '8d8360fb',
1515
'differential.pkg.js' => '67e02996',
@@ -173,7 +173,7 @@
173173
'rsrc/css/phui/phui-segment-bar-view.css' => '5166b370',
174174
'rsrc/css/phui/phui-spacing.css' => 'b05cadc3',
175175
'rsrc/css/phui/phui-status.css' => 'e5ff8be0',
176-
'rsrc/css/phui/phui-tag-view.css' => '29409667',
176+
'rsrc/css/phui/phui-tag-view.css' => '8519160a',
177177
'rsrc/css/phui/phui-timeline-view.css' => '1e348e4b',
178178
'rsrc/css/phui/phui-two-column-view.css' => '01e6991e',
179179
'rsrc/css/phui/workboards/phui-workboard-color.css' => 'e86de308',
@@ -862,7 +862,7 @@
862862
'phui-segment-bar-view-css' => '5166b370',
863863
'phui-spacing-css' => 'b05cadc3',
864864
'phui-status-list-view-css' => 'e5ff8be0',
865-
'phui-tag-view-css' => '29409667',
865+
'phui-tag-view-css' => '8519160a',
866866
'phui-theme-css' => '35883b37',
867867
'phui-timeline-view-css' => '1e348e4b',
868868
'phui-two-column-view-css' => '01e6991e',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE IF EXISTS {$NAMESPACE}_dashboard.dashboard_dashboard_ngrams;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE IF EXISTS {$NAMESPACE}_dashboard.dashboard_dashboardpanel_ngrams;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_fdocument (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
objectPHID VARBINARY(64) NOT NULL,
4+
isClosed BOOL NOT NULL,
5+
authorPHID VARBINARY(64),
6+
ownerPHID VARBINARY(64),
7+
epochCreated INT UNSIGNED NOT NULL,
8+
epochModified INT UNSIGNED NOT NULL
9+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_ffield (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
documentID INT UNSIGNED NOT NULL,
4+
fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT},
5+
rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
6+
termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
7+
normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}
8+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_fngrams (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
documentID INT UNSIGNED NOT NULL,
4+
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}
5+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_dashboard_fngrams_common (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT},
4+
needsCollection BOOL NOT NULL,
5+
UNIQUE KEY `key_ngram` (ngram),
6+
KEY `key_collect` (needsCollection)
7+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_fdocument (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
objectPHID VARBINARY(64) NOT NULL,
4+
isClosed BOOL NOT NULL,
5+
authorPHID VARBINARY(64),
6+
ownerPHID VARBINARY(64),
7+
epochCreated INT UNSIGNED NOT NULL,
8+
epochModified INT UNSIGNED NOT NULL
9+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_ffield (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
documentID INT UNSIGNED NOT NULL,
4+
fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT},
5+
rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
6+
termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
7+
normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}
8+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_fngrams (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
documentID INT UNSIGNED NOT NULL,
4+
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}
5+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE TABLE {$NAMESPACE}_dashboard.dashboard_panel_fngrams_common (
2+
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT},
4+
needsCollection BOOL NOT NULL,
5+
UNIQUE KEY `key_ngram` (ngram),
6+
KEY `key_collect` (needsCollection)
7+
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

‎src/__phutil_library_map__.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -2919,7 +2919,9 @@
29192919
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/dashboard/PhabricatorDashboardEditController.php',
29202920
'PhabricatorDashboardEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardEditEngine.php',
29212921
'PhabricatorDashboardFavoritesInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardFavoritesInstallWorkflow.php',
2922+
'PhabricatorDashboardFerretEngine' => 'applications/dashboard/engine/PhabricatorDashboardFerretEngine.php',
29222923
'PhabricatorDashboardFullLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardFullLayoutMode.php',
2924+
'PhabricatorDashboardFulltextEngine' => 'applications/dashboard/engine/PhabricatorDashboardFulltextEngine.php',
29232925
'PhabricatorDashboardHalfLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardHalfLayoutMode.php',
29242926
'PhabricatorDashboardHomeInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardHomeInstallWorkflow.php',
29252927
'PhabricatorDashboardIconSet' => 'applications/dashboard/icon/PhabricatorDashboardIconSet.php',
@@ -2930,7 +2932,6 @@
29302932
'PhabricatorDashboardLayoutTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardLayoutTransaction.php',
29312933
'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php',
29322934
'PhabricatorDashboardNameTransaction' => 'applications/dashboard/xaction/dashboard/PhabricatorDashboardNameTransaction.php',
2933-
'PhabricatorDashboardNgrams' => 'applications/dashboard/storage/PhabricatorDashboardNgrams.php',
29342935
'PhabricatorDashboardObjectInstallWorkflow' => 'applications/dashboard/install/PhabricatorDashboardObjectInstallWorkflow.php',
29352936
'PhabricatorDashboardOneThirdLayoutMode' => 'applications/dashboard/layoutconfig/PhabricatorDashboardOneThirdLayoutMode.php',
29362937
'PhabricatorDashboardPanel' => 'applications/dashboard/storage/PhabricatorDashboardPanel.php',
@@ -2941,9 +2942,10 @@
29412942
'PhabricatorDashboardPanelEditConduitAPIMethod' => 'applications/dashboard/conduit/PhabricatorDashboardPanelEditConduitAPIMethod.php',
29422943
'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php',
29432944
'PhabricatorDashboardPanelEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php',
2945+
'PhabricatorDashboardPanelFerretEngine' => 'applications/dashboard/engine/PhabricatorDashboardPanelFerretEngine.php',
2946+
'PhabricatorDashboardPanelFulltextEngine' => 'applications/dashboard/engine/PhabricatorDashboardPanelFulltextEngine.php',
29442947
'PhabricatorDashboardPanelListController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelListController.php',
29452948
'PhabricatorDashboardPanelNameTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php',
2946-
'PhabricatorDashboardPanelNgrams' => 'applications/dashboard/storage/PhabricatorDashboardPanelNgrams.php',
29472949
'PhabricatorDashboardPanelPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php',
29482950
'PhabricatorDashboardPanelPropertyTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelPropertyTransaction.php',
29492951
'PhabricatorDashboardPanelQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelQuery.php',
@@ -8900,7 +8902,8 @@
89008902
'PhabricatorFlaggableInterface',
89018903
'PhabricatorDestructibleInterface',
89028904
'PhabricatorProjectInterface',
8903-
'PhabricatorNgramsInterface',
8905+
'PhabricatorFulltextInterface',
8906+
'PhabricatorFerretInterface',
89048907
'PhabricatorDashboardPanelContainerInterface',
89058908
),
89068909
'PhabricatorDashboardAdjustController' => 'PhabricatorDashboardController',
@@ -8916,7 +8919,9 @@
89168919
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
89178920
'PhabricatorDashboardEditEngine' => 'PhabricatorEditEngine',
89188921
'PhabricatorDashboardFavoritesInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow',
8922+
'PhabricatorDashboardFerretEngine' => 'PhabricatorFerretEngine',
89198923
'PhabricatorDashboardFullLayoutMode' => 'PhabricatorDashboardLayoutMode',
8924+
'PhabricatorDashboardFulltextEngine' => 'PhabricatorFulltextEngine',
89208925
'PhabricatorDashboardHalfLayoutMode' => 'PhabricatorDashboardLayoutMode',
89218926
'PhabricatorDashboardHomeInstallWorkflow' => 'PhabricatorDashboardApplicationInstallWorkflow',
89228927
'PhabricatorDashboardIconSet' => 'PhabricatorIconSet',
@@ -8927,7 +8932,6 @@
89278932
'PhabricatorDashboardLayoutTransaction' => 'PhabricatorDashboardTransactionType',
89288933
'PhabricatorDashboardListController' => 'PhabricatorDashboardController',
89298934
'PhabricatorDashboardNameTransaction' => 'PhabricatorDashboardTransactionType',
8930-
'PhabricatorDashboardNgrams' => 'PhabricatorSearchNgrams',
89318935
'PhabricatorDashboardObjectInstallWorkflow' => 'PhabricatorDashboardInstallWorkflow',
89328936
'PhabricatorDashboardOneThirdLayoutMode' => 'PhabricatorDashboardLayoutMode',
89338937
'PhabricatorDashboardPanel' => array(
@@ -8936,7 +8940,8 @@
89368940
'PhabricatorPolicyInterface',
89378941
'PhabricatorFlaggableInterface',
89388942
'PhabricatorDestructibleInterface',
8939-
'PhabricatorNgramsInterface',
8943+
'PhabricatorFulltextInterface',
8944+
'PhabricatorFerretInterface',
89408945
'PhabricatorDashboardPanelContainerInterface',
89418946
),
89428947
'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController',
@@ -8945,9 +8950,10 @@
89458950
'PhabricatorDashboardPanelEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
89468951
'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController',
89478952
'PhabricatorDashboardPanelEditEngine' => 'PhabricatorEditEngine',
8953+
'PhabricatorDashboardPanelFerretEngine' => 'PhabricatorFerretEngine',
8954+
'PhabricatorDashboardPanelFulltextEngine' => 'PhabricatorFulltextEngine',
89488955
'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController',
89498956
'PhabricatorDashboardPanelNameTransaction' => 'PhabricatorDashboardPanelTransactionType',
8950-
'PhabricatorDashboardPanelNgrams' => 'PhabricatorSearchNgrams',
89518957
'PhabricatorDashboardPanelPHIDType' => 'PhabricatorPHIDType',
89528958
'PhabricatorDashboardPanelPropertyTransaction' => 'PhabricatorDashboardPanelTransactionType',
89538959
'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
final class PhabricatorDashboardFerretEngine
4+
extends PhabricatorFerretEngine {
5+
6+
public function getApplicationName() {
7+
return 'dashboard';
8+
}
9+
10+
public function getScopeName() {
11+
return 'dashboard';
12+
}
13+
14+
public function newSearchEngine() {
15+
return new PhabricatorDashboardSearchEngine();
16+
}
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
final class PhabricatorDashboardFulltextEngine
4+
extends PhabricatorFulltextEngine {
5+
6+
protected function buildAbstractDocument(
7+
PhabricatorSearchAbstractDocument $document,
8+
$object) {
9+
10+
$dashboard = $object;
11+
12+
$document->setDocumentTitle($dashboard->getName());
13+
14+
$document->addRelationship(
15+
$dashboard->isArchived()
16+
? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
17+
: PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
18+
$dashboard->getPHID(),
19+
PhabricatorDashboardDashboardPHIDType::TYPECONST,
20+
PhabricatorTime::getNow());
21+
}
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
final class PhabricatorDashboardPanelFerretEngine
4+
extends PhabricatorFerretEngine {
5+
6+
public function getApplicationName() {
7+
return 'dashboard';
8+
}
9+
10+
public function getScopeName() {
11+
return 'panel';
12+
}
13+
14+
public function newSearchEngine() {
15+
return new PhabricatorDashboardPanelSearchEngine();
16+
}
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
final class PhabricatorDashboardPanelFulltextEngine
4+
extends PhabricatorFulltextEngine {
5+
6+
protected function buildAbstractDocument(
7+
PhabricatorSearchAbstractDocument $document,
8+
$object) {
9+
10+
$panel = $object;
11+
12+
$document->setDocumentTitle($panel->getName());
13+
14+
$document->addRelationship(
15+
$panel->getIsArchived()
16+
? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
17+
: PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
18+
$panel->getPHID(),
19+
PhabricatorDashboardPanelPHIDType::TYPECONST,
20+
PhabricatorTime::getNow());
21+
}
22+
23+
}

‎src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php

-6
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ public function withAuthorPHIDs(array $authors) {
3434
return $this;
3535
}
3636

37-
public function withNameNgrams($ngrams) {
38-
return $this->withNgramsConstraint(
39-
id(new PhabricatorDashboardPanelNgrams()),
40-
$ngrams);
41-
}
42-
4337
protected function loadPage() {
4438
return $this->loadStandardPage($this->newResultObject());
4539
}

‎src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php

-8
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,12 @@ protected function buildQueryFromParameters(array $map) {
4242
$query->withAuthorPHIDs($map['authorPHIDs']);
4343
}
4444

45-
if ($map['name'] !== null) {
46-
$query->withNameNgrams($map['name']);
47-
}
48-
4945
return $query;
5046
}
5147

5248
protected function buildCustomSearchFields() {
5349

5450
return array(
55-
id(new PhabricatorSearchTextField())
56-
->setLabel(pht('Name Contains'))
57-
->setKey('name')
58-
->setDescription(pht('Search for panels by name substring.')),
5951
id(new PhabricatorSearchDatasourceField())
6052
->setLabel(pht('Authored By'))
6153
->setKey('authorPHIDs')

‎src/applications/dashboard/query/PhabricatorDashboardQuery.php

+4-10
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ public function withCanEdit($can_edit) {
3434
return $this;
3535
}
3636

37-
public function withNameNgrams($ngrams) {
38-
return $this->withNgramsConstraint(
39-
id(new PhabricatorDashboardNgrams()),
40-
$ngrams);
41-
}
42-
4337
protected function loadPage() {
4438
return $this->loadStandardPage($this->newResultObject());
4539
}
@@ -70,28 +64,28 @@ protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
7064
if ($this->ids !== null) {
7165
$where[] = qsprintf(
7266
$conn,
73-
'id IN (%Ld)',
67+
'dashboard.id IN (%Ld)',
7468
$this->ids);
7569
}
7670

7771
if ($this->phids !== null) {
7872
$where[] = qsprintf(
7973
$conn,
80-
'phid IN (%Ls)',
74+
'dashboard.phid IN (%Ls)',
8175
$this->phids);
8276
}
8377

8478
if ($this->statuses !== null) {
8579
$where[] = qsprintf(
8680
$conn,
87-
'status IN (%Ls)',
81+
'dashboard.status IN (%Ls)',
8882
$this->statuses);
8983
}
9084

9185
if ($this->authorPHIDs !== null) {
9286
$where[] = qsprintf(
9387
$conn,
94-
'authorPHID IN (%Ls)',
88+
'dashboard.authorPHID IN (%Ls)',
9589
$this->authorPHIDs);
9690
}
9791

0 commit comments

Comments
 (0)
Failed to load comments.