mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 21:16:07 +00:00
remove folders from fulltext index
This commit is contained in:
parent
beaa54ac92
commit
44daf8cc10
|
@ -44,17 +44,25 @@ class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common {
|
||||||
/* Register a callback which removes each document from the fulltext index
|
/* Register a callback which removes each document from the fulltext index
|
||||||
* The callback must return null other the removal will be canceled.
|
* The callback must return null other the removal will be canceled.
|
||||||
*/
|
*/
|
||||||
function removeFromIndex($fulltextservice, $document) {
|
function removeFromIndex($arr, $document) {
|
||||||
|
$fulltextservice = $arr[0];
|
||||||
$lucenesearch = $fulltextservice->Search();
|
$lucenesearch = $fulltextservice->Search();
|
||||||
if($hit = $lucenesearch->getDocument($document->getID())) {
|
$hit = null;
|
||||||
|
if($document->isType('document'))
|
||||||
|
$hit = $lucenesearch->getDocument($document->getID());
|
||||||
|
elseif($document->isType('folder'))
|
||||||
|
$hit = $lucenesearch->getFolder($document->getID());
|
||||||
|
if($hit) {
|
||||||
$index = $fulltextservice->Indexer();
|
$index = $fulltextservice->Indexer();
|
||||||
$index->delete($hit->id);
|
$index->delete($hit->id);
|
||||||
$index->commit();
|
$index->commit();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if($fulltextservice && ($index = $fulltextservice->Indexer()))
|
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
|
||||||
$dms->setCallback('onPreRemoveDocument', 'removeFromIndex', array($fulltextservice));
|
$dms->addCallback('onPreRemoveDocument', 'removeFromIndex', array($fulltextservice));
|
||||||
|
$dms->addCallback('onPreRemoveFolder', 'removeFromIndex', array($fulltextservice));
|
||||||
|
}
|
||||||
|
|
||||||
function removePreviews($arr, $document) {
|
function removePreviews($arr, $document) {
|
||||||
$previewer = $arr[0];
|
$previewer = $arr[0];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user