Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14002853
D13090.id31748.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D13090.id31748.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -642,12 +642,14 @@
'DivinerAtomQuery' => 'applications/diviner/query/DivinerAtomQuery.php',
'DivinerAtomRef' => 'applications/diviner/atom/DivinerAtomRef.php',
'DivinerAtomSearchEngine' => 'applications/diviner/query/DivinerAtomSearchEngine.php',
+ 'DivinerAtomSearchIndexer' => 'applications/diviner/search/DivinerAtomSearchIndexer.php',
'DivinerAtomizeWorkflow' => 'applications/diviner/workflow/DivinerAtomizeWorkflow.php',
'DivinerAtomizer' => 'applications/diviner/atomizer/DivinerAtomizer.php',
'DivinerBookController' => 'applications/diviner/controller/DivinerBookController.php',
'DivinerBookItemView' => 'applications/diviner/view/DivinerBookItemView.php',
'DivinerBookPHIDType' => 'applications/diviner/phid/DivinerBookPHIDType.php',
'DivinerBookQuery' => 'applications/diviner/query/DivinerBookQuery.php',
+ 'DivinerBookSearchIndexer' => 'applications/diviner/search/DivinerBookSearchIndexer.php',
'DivinerController' => 'applications/diviner/controller/DivinerController.php',
'DivinerDAO' => 'applications/diviner/storage/DivinerDAO.php',
'DivinerDefaultRenderer' => 'applications/diviner/renderer/DivinerDefaultRenderer.php',
@@ -3887,11 +3889,13 @@
'DivinerAtomPHIDType' => 'PhabricatorPHIDType',
'DivinerAtomQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DivinerAtomSearchEngine' => 'PhabricatorApplicationSearchEngine',
+ 'DivinerAtomSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'DivinerAtomizeWorkflow' => 'DivinerWorkflow',
'DivinerBookController' => 'DivinerController',
'DivinerBookItemView' => 'AphrontTagView',
'DivinerBookPHIDType' => 'PhabricatorPHIDType',
'DivinerBookQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'DivinerBookSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'DivinerController' => 'PhabricatorController',
'DivinerDAO' => 'PhabricatorLiskDAO',
'DivinerDefaultRenderer' => 'DivinerRenderer',
@@ -3902,6 +3906,7 @@
'DivinerLiveBook' => array(
'DivinerDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorProjectInterface',
'PhabricatorDestructibleInterface',
),
'DivinerLivePublisher' => 'DivinerPublisher',
diff --git a/src/applications/diviner/application/PhabricatorDivinerApplication.php b/src/applications/diviner/application/PhabricatorDivinerApplication.php
--- a/src/applications/diviner/application/PhabricatorDivinerApplication.php
+++ b/src/applications/diviner/application/PhabricatorDivinerApplication.php
@@ -58,4 +58,11 @@
);
}
+ public function getApplicationSearchDocumentTypes() {
+ return array(
+ DivinerAtomPHIDType::TYPECONST,
+ DivinerBookPHIDType::TYPECONST,
+ );
+ }
+
}
diff --git a/src/applications/diviner/phid/DivinerAtomPHIDType.php b/src/applications/diviner/phid/DivinerAtomPHIDType.php
--- a/src/applications/diviner/phid/DivinerAtomPHIDType.php
+++ b/src/applications/diviner/phid/DivinerAtomPHIDType.php
@@ -5,7 +5,7 @@
const TYPECONST = 'ATOM';
public function getTypeName() {
- return pht('Atom');
+ return pht('Diviner Atom');
}
public function newObject() {
diff --git a/src/applications/diviner/phid/DivinerBookPHIDType.php b/src/applications/diviner/phid/DivinerBookPHIDType.php
--- a/src/applications/diviner/phid/DivinerBookPHIDType.php
+++ b/src/applications/diviner/phid/DivinerBookPHIDType.php
@@ -5,7 +5,7 @@
const TYPECONST = 'BOOK';
public function getTypeName() {
- return pht('Book');
+ return pht('Diviner Book');
}
public function newObject() {
@@ -32,7 +32,7 @@
$handle->setName($book->getShortTitle());
$handle->setFullName($book->getTitle());
- $handle->setURI("/diviner/book/{$name}/");
+ $handle->setURI("/book/{$name}/");
}
}
diff --git a/src/applications/diviner/publisher/DivinerLivePublisher.php b/src/applications/diviner/publisher/DivinerLivePublisher.php
--- a/src/applications/diviner/publisher/DivinerLivePublisher.php
+++ b/src/applications/diviner/publisher/DivinerLivePublisher.php
@@ -18,6 +18,9 @@
$book->setConfigurationData($this->getConfigurationData())->save();
$this->book = $book;
+
+ id(new PhabricatorSearchIndexer())
+ ->queueDocumentForIndexing($book->getPHID());
}
return $this->book;
@@ -124,6 +127,9 @@
$symbol->save();
+ id(new PhabricatorSearchIndexer())
+ ->queueDocumentForIndexing($symbol->getPHID());
+
// TODO: We probably need a finer-grained sense of what "documentable"
// atoms are. Neither files nor methods are currently considered
// documentable, but for different reasons: files appear nowhere, while
diff --git a/src/applications/diviner/search/DivinerAtomSearchIndexer.php b/src/applications/diviner/search/DivinerAtomSearchIndexer.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diviner/search/DivinerAtomSearchIndexer.php
@@ -0,0 +1,31 @@
+<?php
+
+final class DivinerAtomSearchIndexer extends PhabricatorSearchDocumentIndexer {
+
+ public function getIndexableObject() {
+ return new DivinerLiveSymbol();
+ }
+
+ protected function buildAbstractDocumentByPHID($phid) {
+ $atom = $this->loadDocumentByPHID($phid);
+ $book = $atom->getBook();
+
+ $doc = $this->newDocument($phid)
+ ->setDocumentTitle($atom->getTitle())
+ ->setDocumentCreated($book->getDateCreated())
+ ->setDocumentModified($book->getDateModified());
+
+ $doc->addField(
+ PhabricatorSearchField::FIELD_BODY,
+ $atom->getSummary());
+
+ $doc->addRelationship(
+ PhabricatorSearchRelationship::RELATIONSHIP_BOOK,
+ $atom->getBookPHID(),
+ DivinerBookPHIDType::TYPECONST,
+ $book->getDateCreated());
+
+ return $doc;
+ }
+
+}
diff --git a/src/applications/diviner/search/DivinerBookSearchIndexer.php b/src/applications/diviner/search/DivinerBookSearchIndexer.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diviner/search/DivinerBookSearchIndexer.php
@@ -0,0 +1,25 @@
+<?php
+
+final class DivinerBookSearchIndexer extends PhabricatorSearchDocumentIndexer {
+
+ public function getIndexableObject() {
+ return new DivinerLiveBook();
+ }
+
+ protected function buildAbstractDocumentByPHID($phid) {
+ $book = $this->loadDocumentByPHID($phid);
+
+ $doc = $this->newDocument($phid)
+ ->setDocumentTitle($book->getTitle())
+ ->setDocumentCreated($book->getDateCreated())
+ ->setDocumentModified($book->getDateModified());
+
+ $doc->addField(
+ PhabricatorSearchField::FIELD_BODY,
+ $book->getPreface());
+
+ return $doc;
+ }
+
+
+}
diff --git a/src/applications/diviner/storage/DivinerLiveBook.php b/src/applications/diviner/storage/DivinerLiveBook.php
--- a/src/applications/diviner/storage/DivinerLiveBook.php
+++ b/src/applications/diviner/storage/DivinerLiveBook.php
@@ -42,8 +42,7 @@
}
public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(
- DivinerBookPHIDType::TYPECONST);
+ return PhabricatorPHID::generateNewPHID(DivinerBookPHIDType::TYPECONST);
}
public function getTitle() {
diff --git a/src/applications/search/constants/PhabricatorSearchRelationship.php b/src/applications/search/constants/PhabricatorSearchRelationship.php
--- a/src/applications/search/constants/PhabricatorSearchRelationship.php
+++ b/src/applications/search/constants/PhabricatorSearchRelationship.php
@@ -3,6 +3,7 @@
final class PhabricatorSearchRelationship {
const RELATIONSHIP_AUTHOR = 'auth';
+ const RELATIONSHIP_BOOK = 'book';
const RELATIONSHIP_REVIEWER = 'revw';
const RELATIONSHIP_SUBSCRIBER = 'subs';
const RELATIONSHIP_COMMENTER = 'comm';
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 26, 11:11 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6751510
Default Alt Text
D13090.id31748.diff (7 KB)
Attached To
Mode
D13090: Integrate Diviner with global search
Attached
Detach File
Event Timeline
Log In to Comment