Difference between revisions of "Knowledge:Utilities"
From OpenKM Documentation
(→List missing datastore document) |
|||
Line 50: | Line 50: | ||
} | } | ||
} | } | ||
+ | </source> | ||
+ | |||
+ | == Force text extraction from a folder == | ||
+ | <source lang="java"> | ||
+ | import com.openkm.dao.bean.*; | ||
+ | import com.openkm.dao.*; | ||
+ | |||
+ | void changeNodes(String parentUuid) { | ||
+ | for (NodeFolder nFld : NodeFolderDAO.getInstance().findByParent(parentUuid)) { | ||
+ | print("Folder: " + nFld.getUuid() + "<br/>"); | ||
+ | changeNodes(nFld.getUuid()); | ||
+ | } | ||
+ | |||
+ | for (NodeDocument nDoc : NodeDocumentDAO.getInstance().findByParent(parentUuid)) { | ||
+ | print("Document: " + nDoc.getUuid() + "<br/>"); | ||
+ | NodeDocumentDAO.getInstance().resetPendingExtractionFlag(nDoc.getUuid()); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | changeNodes("folder-uuid"); | ||
</source> | </source> |
Revision as of 15:53, 8 October 2012
Contents
Show text extracted from document
HQL
select nd.uuid, nd.textExtracted, nd.text from NodeDocument nd where nd.uuid='document-uuid';
SQL
select NBS_UUID, NDC_TEXT_EXTRACTED, NDC_TEXT from OKM_NODE_DOCUMENT where NBS_UUID='document-uuid';
Show text extracted of folder children documents
SQL
select NBS_UUID, NDC_TEXT_EXTRACTED, NDC_TEXT from OKM_NODE_DOCUMENT where NBS_UUID in (select NBS_UUID from OKM_NODE_BASE where NBS_PARENT='folder-uuid');
Force document text extraction
HQL
update NodeDocument nd set nd.textExtracted=false where nd.uuid='document-uuid';
SQL
update OKM_NODE_DOCUMENT set NDC_TEXT_EXTRACTED='F' where NBS_UUID='document-uuid';
Force document text extraction of folder children documents
SQL
update OKM_NODE_DOCUMENT set NDC_TEXT_EXTRACTED='F' where NBS_UUID in (select NBS_UUID from OKM_NODE_BASE where NBS_PARENT='folder-uuid');
List missing datastore document
import com.openkm.module.db.stuff.*;
import com.openkm.dao.bean.*;
import com.openkm.dao.*;
for (NodeDocumentVersion ndv : NodeDocumentVersionDAO.getInstance().findAll()) {
String verUuid = ndv.getUuid();
File file = FsDataStore.resolveFile(verUuid);
if (!file.exists()) {
String docUuid = ndv.getParent();
String docPath = NodeBaseDAO.getInstance().getPathFromUuid(docUuid);
print("File: " + file + "<br/>");
print("Path: " + docPath + "<br/>");
}
}
Force text extraction from a folder
import com.openkm.dao.bean.*;
import com.openkm.dao.*;
void changeNodes(String parentUuid) {
for (NodeFolder nFld : NodeFolderDAO.getInstance().findByParent(parentUuid)) {
print("Folder: " + nFld.getUuid() + "<br/>");
changeNodes(nFld.getUuid());
}
for (NodeDocument nDoc : NodeDocumentDAO.getInstance().findByParent(parentUuid)) {
print("Document: " + nDoc.getUuid() + "<br/>");
NodeDocumentDAO.getInstance().resetPendingExtractionFlag(nDoc.getUuid());
}
}
changeNodes("folder-uuid");