Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91716369
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
Wed, Nov 13, 19:24
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 15, 19:24 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22311487
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