@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove the fulltext "reconstructDocument()" method

Summary: Ref T12819. This was originally intended for debugging, but never actually used and not clearly useful. There are no callers and it probably does not work. Just get rid of it.

Test Plan: Grepped for callers; none exist.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12819

Differential Revision: https://secure.phabricator.com/D18544

-112
-36
src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php
··· 105 105 $this->executeRequest($host, "/{$type}/{$phid}/", $spec, 'PUT'); 106 106 } 107 107 108 - public function reconstructDocument($phid) { 109 - $type = phid_get_type($phid); 110 - $host = $this->getHostForRead(); 111 - $response = $this->executeRequest($host, "/{$type}/{$phid}", array()); 112 - 113 - if (empty($response['exists'])) { 114 - return null; 115 - } 116 - 117 - $hit = $response['_source']; 118 - 119 - $doc = new PhabricatorSearchAbstractDocument(); 120 - $doc->setPHID($phid); 121 - $doc->setDocumentType($response['_type']); 122 - $doc->setDocumentTitle($hit['title']); 123 - $doc->setDocumentCreated($hit['dateCreated']); 124 - $doc->setDocumentModified($hit[$this->getTimestampField()]); 125 - 126 - foreach ($hit['field'] as $fdef) { 127 - $field_type = $fdef['type']; 128 - $doc->addField($field_type, $hit[$field_type], $fdef['aux']); 129 - } 130 - 131 - foreach ($hit['relationship'] as $rtype => $rships) { 132 - foreach ($rships as $rship) { 133 - $doc->addRelationship( 134 - $rtype, 135 - $rship['phid'], 136 - $rship['phidType'], 137 - $rship['when']); 138 - } 139 - } 140 - 141 - return $doc; 142 - } 143 - 144 108 private function buildSpec(PhabricatorSavedQuery $query) { 145 109 $q = new PhabricatorElasticsearchQueryBuilder('bool'); 146 110 $query_string = $query->getParameter('query');
-9
src/applications/search/fulltextstorage/PhabricatorFulltextStorageEngine.php
··· 54 54 PhabricatorSearchAbstractDocument $document); 55 55 56 56 /** 57 - * Reconstruct the document for a given PHID. This is used for debugging 58 - * and does not need to be perfect if it is unreasonable to implement it. 59 - * 60 - * @param phid Document PHID to reconstruct. 61 - * @return PhabricatorSearchAbstractDocument Abstract document. 62 - */ 63 - abstract public function reconstructDocument($phid); 64 - 65 - /** 66 57 * Execute a search query. 67 58 * 68 59 * @param PhabricatorSavedQuery A query to execute.
-67
src/applications/search/fulltextstorage/PhabricatorMySQLFulltextStorageEngine.php
··· 91 91 92 92 } 93 93 94 - /** 95 - * Rebuild the PhabricatorSearchAbstractDocument that was used to index 96 - * an object out of the index itself. This is primarily useful for debugging, 97 - * as it allows you to inspect the search index representation of a 98 - * document. 99 - * 100 - * @param phid PHID of a document which exists in the search index. 101 - * @return null|PhabricatorSearchAbstractDocument Abstract document object 102 - * which corresponds to the original abstract document used to 103 - * build the document index. 104 - */ 105 - public function reconstructDocument($phid) { 106 - $dao_doc = new PhabricatorSearchDocument(); 107 - $dao_field = new PhabricatorSearchDocumentField(); 108 - $dao_relationship = new PhabricatorSearchDocumentRelationship(); 109 - 110 - $t_doc = $dao_doc->getTableName(); 111 - $t_field = $dao_field->getTableName(); 112 - $t_relationship = $dao_relationship->getTableName(); 113 - 114 - $doc = queryfx_one( 115 - $dao_doc->establishConnection('r'), 116 - 'SELECT * FROM %T WHERE phid = %s', 117 - $t_doc, 118 - $phid); 119 - 120 - if (!$doc) { 121 - return null; 122 - } 123 - 124 - $fields = queryfx_all( 125 - $dao_field->establishConnection('r'), 126 - 'SELECT * FROM %T WHERE phid = %s', 127 - $t_field, 128 - $phid); 129 - 130 - $relationships = queryfx_all( 131 - $dao_relationship->establishConnection('r'), 132 - 'SELECT * FROM %T WHERE phid = %s', 133 - $t_relationship, 134 - $phid); 135 - 136 - $adoc = id(new PhabricatorSearchAbstractDocument()) 137 - ->setPHID($phid) 138 - ->setDocumentType($doc['documentType']) 139 - ->setDocumentTitle($doc['documentTitle']) 140 - ->setDocumentCreated($doc['documentCreated']) 141 - ->setDocumentModified($doc['documentModified']); 142 - 143 - foreach ($fields as $field) { 144 - $adoc->addField( 145 - $field['field'], 146 - $field['corpus'], 147 - $field['auxPHID']); 148 - } 149 - 150 - foreach ($relationships as $relationship) { 151 - $adoc->addRelationship( 152 - $relationship['relation'], 153 - $relationship['relatedPHID'], 154 - $relationship['relatedType'], 155 - $relationship['relatedTime']); 156 - } 157 - 158 - return $adoc; 159 - } 160 - 161 94 public function executeSearch(PhabricatorSavedQuery $query) { 162 95 $table = new PhabricatorSearchDocument(); 163 96 $document_table = $table->getTableName();