Difference between revisions of "User:Pavila"

From OpenKM Documentation
Jump to: navigation, search
Line 27: Line 27:
 
select count(*) from NodeDocument nd where size(nd.rolePermissions) > 0; -- Slower
 
select count(*) from NodeDocument nd where size(nd.rolePermissions) > 0; -- Slower
 
select count(*) from NodeDocument nd where exists elements(nd.rolePermissions); -- Faster
 
select count(*) from NodeDocument nd where exists elements(nd.rolePermissions); -- Faster
 +
</source>
 +
 +
'''Find documents with a keyword'''
 +
<source lang="sql">
 +
from NodeDocument nd where 'xxx' in elements(nd.keywords);
 
</source>
 
</source>
  

Revision as of 10:34, 15 August 2012

OpenKM Core developer.

import java.util.*;
import java.nio.charset.*;

print("Charset: " + Charset.defaultCharset()+"<br/>");
print("Locale: " + Locale.getDefault()+"<br/>");

Find duplicates - HSQL

select nd.uuid, nd.name, ndv.checksum from NodeDocument nd, NodeDocumentVersion ndv where nd.uuid = ndv.parent and ndv.checksum in 
  (select ndv.checksum from NodeDocumentVersion ndv where ndv.current = true group by ndv.checksum having count(ndv.checksum) > 1) 
order by ndv.checksum, nd.name;

Find duplicates - SQL

select NBS_UUID, NBS_NAME, NDV_CHECKSUM from OKM_NODE_BASE, OKM_NODE_DOCUMENT_VERSION where NBS_UUID = NDV_PARENT and NDV_CHECKSUM in 
  (select NDV_CHECKSUM from OKM_NODE_DOCUMENT_VERSION where NDV_CURRENT='T' group by NDV_CHECKSUM having count(NDV_CHECKSUM) > 1)
order by NDV_CHECKSUM, NBS_NAME;

Find documents with assigned roles

select count(*) from NodeDocument nd where size(nd.rolePermissions) > 0; -- Slower
select count(*) from NodeDocument nd where exists elements(nd.rolePermissions); -- Faster

Find documents with a keyword

from NodeDocument nd where 'xxx' in elements(nd.keywords);

TO DO

Books

See also