Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / search / fulltextstorage / PhabricatorFulltextStorageEngine.php
blobba019ea59373bca6d96e498c0f2b5cbebec3408c
1 <?php
3 /**
4 * Base class for Phabricator search engine providers. Each engine must offer
5 * three capabilities: indexing, searching, and reconstruction (this can be
6 * stubbed out if an engine can't reasonably do it, it is used for debugging).
7 */
8 abstract class PhabricatorFulltextStorageEngine extends Phobject {
10 protected $service;
12 public function getHosts() {
13 return $this->service->getHosts();
16 public function setService(PhabricatorSearchService $service) {
17 $this->service = $service;
18 return $this;
21 /**
22 * @return PhabricatorSearchService
24 public function getService() {
25 return $this->service;
28 /**
29 * Implementations must return a prototype host instance which is cloned
30 * by the PhabricatorSearchService infrastructure to configure each engine.
31 * @return PhabricatorSearchHost
33 abstract public function getHostType();
35 /* -( Engine Metadata )---------------------------------------------------- */
37 /**
38 * Return a unique, nonempty string which identifies this storage engine.
40 * @return string Unique string for this engine, max length 32.
41 * @task meta
43 abstract public function getEngineIdentifier();
45 /* -( Managing Documents )------------------------------------------------- */
47 /**
48 * Update the index for an abstract document.
50 * @param PhabricatorSearchAbstractDocument Document to update.
51 * @return void
53 abstract public function reindexAbstractDocument(
54 PhabricatorSearchAbstractDocument $document);
56 /**
57 * Execute a search query.
59 * @param PhabricatorSavedQuery A query to execute.
60 * @return list A list of matching PHIDs.
62 abstract public function executeSearch(PhabricatorSavedQuery $query);
64 /**
65 * Does the search index exist?
67 * @return bool
69 abstract public function indexExists();
71 /**
72 * Implementations should override this method to return a dictionary of
73 * stats which are suitable for display in the admin UI.
75 abstract public function getIndexStats();
78 /**
79 * Is the index in a usable state?
81 * @return bool
83 public function indexIsSane() {
84 return $this->indexExists();
87 /**
88 * Do any sort of setup for the search index.
90 * @return void
92 public function initIndex() {}
95 public function getFulltextTokens() {
96 return array();