Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894830
D25430.1737232435.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
D25430.1737232435.diff
View Options
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;
@@ -62,10 +61,6 @@
$slugs = array();
foreach ($identifiers as $identifier) {
- if ($identifier === null) {
- continue;
- }
-
if (ctype_digit((string)$identifier)) {
$ids[$identifier] = $identifier;
continue;
@@ -124,11 +119,6 @@
return $this;
}
- public function withDatasourceQuery($query) {
- $this->datasourceQuery = $query;
- return $this;
- }
-
public function withSlugs(array $slugs) {
$this->slugs = $slugs;
return $this;
@@ -637,22 +627,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());
+
+ $titleFields = array(
+ $repo->getName(),
+ $repo->getRepositorySlug(),
+ );
+ $callsign = $repo->getCallsign();
+ if ($callsign) {
+ $titleFields[] = $callsign;
+ $titleFields[] = 'r'.$callsign;
+ }
+
+ $document->setDocumentTitle(implode("\n", $titleFields));
$document->addField(
PhabricatorSearchDocumentFieldType::FIELD_BODY,
- $repo->getRepositorySlug()."\n".$repo->getDetail('description'));
+ $repo->getDetail('description'));
$document->setDocumentCreated($repo->getDateCreated());
$document->setDocumentModified($repo->getDateModified());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 18, 20:33 (1 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1113763
Default Alt Text
D25430.1737232435.diff (3 KB)
Attached To
Mode
D25430: Implement ferret engine in typeahead datasource query for repos
Attached
Detach File
Event Timeline
Log In to Comment