2011-02-15 00:34:20 +01:00
|
|
|
<?php
|
|
|
|
|
2011-09-14 17:02:31 +02:00
|
|
|
/**
|
|
|
|
* @group search
|
|
|
|
*/
|
2011-02-15 00:34:20 +01:00
|
|
|
final class PhabricatorSearchAbstractDocument {
|
|
|
|
|
|
|
|
private $phid;
|
|
|
|
private $documentType;
|
|
|
|
private $documentTitle;
|
|
|
|
private $documentCreated;
|
|
|
|
private $documentModified;
|
|
|
|
private $fields = array();
|
|
|
|
private $relationships = array();
|
|
|
|
|
Improve elasticsearch
Summary: I thought that this will be fun but the elasticsearch API is horrible and the documentation is poor.
Test Plan:
Search for:
- string
- author
- author, owner
- string, author
- open
- string, open, author
- string, exclude
- several authors, several owners
- nothing
- probably all other combinations
Normally, such an exhaustive test plan wouldn't be required but each combination requires a completely different query.
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, Koolvin, btrahan
Differential Revision: https://secure.phabricator.com/D2298
2012-04-21 02:09:30 +02:00
|
|
|
public static function getSupportedTypes() {
|
|
|
|
return array(
|
2013-07-21 17:11:37 +02:00
|
|
|
DifferentialPHIDTypeRevision::TYPECONST => 'Differential Revisions',
|
2013-07-21 19:57:07 +02:00
|
|
|
PhabricatorRepositoryPHIDTypeCommit::TYPECONST => 'Repository Commits',
|
Improve elasticsearch
Summary: I thought that this will be fun but the elasticsearch API is horrible and the documentation is poor.
Test Plan:
Search for:
- string
- author
- author, owner
- string, author
- open
- string, open, author
- string, exclude
- several authors, several owners
- nothing
- probably all other combinations
Normally, such an exhaustive test plan wouldn't be required but each combination requires a completely different query.
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, Koolvin, btrahan
Differential Revision: https://secure.phabricator.com/D2298
2012-04-21 02:09:30 +02:00
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'Maniphest Tasks',
|
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_WIKI => 'Phriction Documents',
|
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_USER => 'Phabricator Users',
|
2012-08-10 19:44:04 +02:00
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_QUES => 'Ponder Questions',
|
2013-01-19 21:11:11 +01:00
|
|
|
);
|
Improve elasticsearch
Summary: I thought that this will be fun but the elasticsearch API is horrible and the documentation is poor.
Test Plan:
Search for:
- string
- author
- author, owner
- string, author
- open
- string, open, author
- string, exclude
- several authors, several owners
- nothing
- probably all other combinations
Normally, such an exhaustive test plan wouldn't be required but each combination requires a completely different query.
Reviewers: epriestley, jungejason
Reviewed By: epriestley
CC: aran, Koolvin, btrahan
Differential Revision: https://secure.phabricator.com/D2298
2012-04-21 02:09:30 +02:00
|
|
|
}
|
|
|
|
|
2011-02-15 00:34:20 +01:00
|
|
|
public function setPHID($phid) {
|
|
|
|
$this->phid = $phid;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDocumentType($document_type) {
|
|
|
|
$this->documentType = $document_type;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDocumentTitle($title) {
|
|
|
|
$this->documentTitle = $title;
|
|
|
|
$this->addField(PhabricatorSearchField::FIELD_TITLE, $title);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addField($field, $corpus, $aux_phid = null) {
|
|
|
|
$this->fields[] = array($field, $corpus, $aux_phid);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-02-19 02:16:00 +01:00
|
|
|
public function addRelationship($type, $related_phid, $rtype, $time) {
|
|
|
|
$this->relationships[] = array($type, $related_phid, $rtype, $time);
|
2011-02-15 00:34:20 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDocumentCreated($date) {
|
|
|
|
$this->documentCreated = $date;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDocumentModified($date) {
|
|
|
|
$this->documentModified = $date;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPHID() {
|
|
|
|
return $this->phid;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDocumentType() {
|
|
|
|
return $this->documentType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDocumentTitle() {
|
|
|
|
return $this->documentTitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDocumentCreated() {
|
|
|
|
return $this->documentCreated;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDocumentModified() {
|
|
|
|
return $this->documentModified;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldData() {
|
|
|
|
return $this->fields;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRelationshipData() {
|
|
|
|
return $this->relationships;
|
|
|
|
}
|
|
|
|
}
|