mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
remove old document/folder from index before adding a new one
This commit is contained in:
parent
4bc32501b8
commit
e328c3c04e
|
@ -1,6 +1,8 @@
|
|||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.22
|
||||
--------------------------------------------------------------------------------
|
||||
- remove document/folder from index before adding a new one after editing the
|
||||
meta data
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.21
|
||||
|
|
|
@ -165,6 +165,10 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
|||
if($fulltextservice && ($index = $fulltextservice->Indexer()) && $document) {
|
||||
$idoc = $fulltextservice->IndexedDocument($document);
|
||||
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
|
||||
$lucenesearch = $fulltextservice->Search();
|
||||
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
|
||||
$index->delete($hit->id);
|
||||
}
|
||||
$index->addDocument($idoc);
|
||||
$index->commit();
|
||||
}
|
||||
|
|
|
@ -93,6 +93,10 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
|
|||
if($fulltextservice && ($index = $fulltextservice->Indexer()) && $folder) {
|
||||
$idoc = $fulltextservice->IndexedDocument($folder);
|
||||
if(false !== $this->callHook('preIndexFolder', $folder, $idoc)) {
|
||||
$lucenesearch = $fulltextservice->Search();
|
||||
if($hit = $lucenesearch->getFolder((int) $folder->getId())) {
|
||||
$index->delete($hit->id);
|
||||
}
|
||||
$index->addDocument($idoc);
|
||||
$index->commit();
|
||||
}
|
||||
|
|
|
@ -77,12 +77,12 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
|
|||
}
|
||||
|
||||
if($fulltextservice && ($index = $fulltextservice->Indexer()) && $content) {
|
||||
$lucenesearch = $fulltextservice->Search();
|
||||
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
|
||||
$index->delete($hit->id);
|
||||
}
|
||||
$idoc = $fulltextservice->IndexedDocument($document);
|
||||
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
|
||||
$lucenesearch = $fulltextservice->Search();
|
||||
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
|
||||
$index->delete($hit->id);
|
||||
}
|
||||
$index->addDocument($idoc);
|
||||
$index->commit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user