Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F70981701
PhabricatorSearchDocumentIndexer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jul 8, 14:52
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Jul 10, 14:52 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18892895
Attached To
rPH Phabricator
PhabricatorSearchDocumentIndexer.php
View Options
<?php
/**
* @group search
*/
abstract
class
PhabricatorSearchDocumentIndexer
{
abstract
public
function
getIndexableObject
();
abstract
protected
function
buildAbstractDocumentByPHID
(
$phid
);
public
function
shouldIndexDocumentByPHID
(
$phid
)
{
$object
=
$this
->
getIndexableObject
();
return
(
phid_get_type
(
$phid
)
==
phid_get_type
(
$object
->
generatePHID
()));
}
public
function
getIndexIterator
()
{
$object
=
$this
->
getIndexableObject
();
return
new
LiskMigrationIterator
(
$object
);
}
protected
function
loadDocumentByPHID
(
$phid
)
{
$object
=
$this
->
getIndexableObject
();
$document
=
$object
->
loadOneWhere
(
'phid = %s'
,
$phid
);
if
(!
$document
)
{
throw
new
Exception
(
"Unable to load document by phid '{$phid}'!"
);
}
return
$document
;
}
public
function
indexDocumentByPHID
(
$phid
)
{
try
{
$document
=
$this
->
buildAbstractDocumentByPHID
(
$phid
);
$engine
=
PhabricatorSearchEngineSelector
::
newSelector
()->
newEngine
();
try
{
$engine
->
reindexAbstractDocument
(
$document
);
}
catch
(
Exception
$ex
)
{
$phid
=
$document
->
getPHID
();
$class
=
get_class
(
$engine
);
phlog
(
"Unable to index document {$phid} by engine {$class}."
);
phlog
(
$ex
);
}
}
catch
(
Exception
$ex
)
{
$class
=
get_class
(
$this
);
phlog
(
"Unable to build document {$phid} by indexer {$class}."
);
phlog
(
$ex
);
}
return
$this
;
}
}
Event Timeline
Log In to Comment