Page MenuHomePhorge

D25430.1737246099.diff
No OneTemporary

D25430.1737246099.diff

diff --git a/resources/sql/autopatches/20230902.repository.01.rebuild-index.php b/resources/sql/autopatches/20230902.repository.01.rebuild-index.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20230902.repository.01.rebuild-index.php
@@ -0,0 +1,6 @@
+<?php
+
+// @phase worker
+
+PhabricatorRebuildIndexesWorker::rebuildObjectsWithQuery(
+ 'PhabricatorRepositoryQuery');
diff --git a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
--- a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
+++ b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
@@ -16,13 +16,16 @@
}
public function loadResults() {
- $viewer = $this->getViewer();
- $raw_query = $this->getRawQuery();
-
$query = id(new PhabricatorRepositoryQuery())
- ->setOrder('name')
- ->withDatasourceQuery($raw_query);
- $repos = $this->executeQuery($query);
+ ->setViewer($this->getViewer());
+
+ $this->applyFerretConstraints(
+ $query,
+ id(new PhabricatorRepository())->newFerretEngine(),
+ 'title',
+ $this->getRawQuery());
+
+ $repos = $query->execute();
$type_icon = id(new PhabricatorRepositoryRepositoryPHIDType())
->getTypeIcon();
diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -9,7 +9,6 @@
private $types;
private $uuids;
private $uris;
- private $datasourceQuery;
private $slugs;
private $almanacServicePHIDs;
@@ -124,11 +123,6 @@
return $this;
}
- public function withDatasourceQuery($query) {
- $this->datasourceQuery = $query;
- return $this;
- }
-
public function withSlugs(array $slugs) {
$this->slugs = $slugs;
return $this;
@@ -637,22 +631,6 @@
$this->uuids);
}
- if (phutil_nonempty_string($this->datasourceQuery)) {
- // This handles having "rP" match callsigns starting with "P...".
- $query = trim($this->datasourceQuery);
- if (preg_match('/^r/', $query)) {
- $callsign = substr($query, 1);
- } else {
- $callsign = $query;
- }
- $where[] = qsprintf(
- $conn,
- 'r.name LIKE %> OR r.callsign LIKE %> OR r.repositorySlug LIKE %>',
- $query,
- $callsign,
- $query);
- }
-
if ($this->slugs !== null) {
$where[] = qsprintf(
$conn,
diff --git a/src/applications/repository/search/PhabricatorRepositoryFulltextEngine.php b/src/applications/repository/search/PhabricatorRepositoryFulltextEngine.php
--- a/src/applications/repository/search/PhabricatorRepositoryFulltextEngine.php
+++ b/src/applications/repository/search/PhabricatorRepositoryFulltextEngine.php
@@ -7,10 +7,21 @@
PhabricatorSearchAbstractDocument $document,
$object) {
$repo = $object;
- $document->setDocumentTitle($repo->getName());
+
+ $title_fields = array(
+ $repo->getName(),
+ $repo->getRepositorySlug(),
+ );
+ $callsign = $repo->getCallsign();
+ if ($callsign) {
+ $title_fields[] = $callsign;
+ $title_fields[] = 'r'.$callsign;
+ }
+
+ $document->setDocumentTitle(implode("\n", $title_fields));
$document->addField(
PhabricatorSearchDocumentFieldType::FIELD_BODY,
- $repo->getRepositorySlug()."\n".$repo->getDetail('description'));
+ $repo->getDetail('description'));
$document->setDocumentCreated($repo->getDateCreated());
$document->setDocumentModified($repo->getDateModified());

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 19, 00:21 (4 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126384
Default Alt Text
D25430.1737246099.diff (3 KB)

Event Timeline