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).
8 abstract class PhabricatorFulltextStorageEngine
extends Phobject
{
12 public function getHosts() {
13 return $this->service
->getHosts();
16 public function setService(PhabricatorSearchService
$service) {
17 $this->service
= $service;
22 * @return PhabricatorSearchService
24 public function getService() {
25 return $this->service
;
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 )---------------------------------------------------- */
38 * Return a unique, nonempty string which identifies this storage engine.
40 * @return string Unique string for this engine, max length 32.
43 abstract public function getEngineIdentifier();
45 /* -( Managing Documents )------------------------------------------------- */
48 * Update the index for an abstract document.
50 * @param PhabricatorSearchAbstractDocument Document to update.
53 abstract public function reindexAbstractDocument(
54 PhabricatorSearchAbstractDocument
$document);
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);
65 * Does the search index exist?
69 abstract public function indexExists();
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();
79 * Is the index in a usable state?
83 public function indexIsSane() {
84 return $this->indexExists();
88 * Do any sort of setup for the search index.
92 public function initIndex() {}
95 public function getFulltextTokens() {