mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
2447d9bdf2
Summary: Ref T9890. Ref T9979. Several adjacent goals: - The `SearchEngine` vs `ApplicationSearchEngine` thing is really confusing. There are also a bunch of confusing class names and class relationships within the fulltext indexing. I want to rename these classes to be more standard (`IndexEngine`, `IndexEngineExtension`, etc). Rename `SearchIndexer` to `IndexEngine`. A future change will rename `SearchEngine`. - Add the index locks described in T9890. - Structure things a little more normally so future diffs can do the "EngineExtension" thing more cleanly. Test Plan: Indexing: - Renamed a task to have a unique word in the title. - Ran `bin/search index Txxx`. - Searched for unique word. - Found task. Locking: - Added a `sleep(10)` after the `lock()` call. - Ran `bin/search index Txxx` in two windows. - Saw first one lock, sleep 10 seconds, index. - Saw second one give up temporarily after failing to grab the lock. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9890, T9979 Differential Revision: https://secure.phabricator.com/D14834
20 lines
451 B
PHP
20 lines
451 B
PHP
<?php
|
|
|
|
final class PhabricatorIndexEngine extends Phobject {
|
|
|
|
public function indexDocumentByPHID($phid, $context) {
|
|
$indexers = id(new PhutilClassMapQuery())
|
|
->setAncestorClass('PhabricatorSearchDocumentIndexer')
|
|
->execute();
|
|
|
|
foreach ($indexers as $indexer) {
|
|
if ($indexer->shouldIndexDocumentByPHID($phid)) {
|
|
$indexer->indexDocumentByPHID($phid, $context);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
}
|