As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
I have a task: "to get a duplicates (documents with same property value) from Alfresco database with count duplicates amounts". In MySql there will be something like that:
mysql> SELECT COUNT(*) AS repetitions, last_name, first_name -> FROM cat_mailing -> GROUP BY last_name, first_name -> HAVING repetitions > 1
But I have read that "The CMIS query language in Alfresco does not support GROUP BY or HAVING." . Is there any query (in any supported language) to perform described task? Thank you!
UPD: for now I am counting in Java this way (redefining hashCode/equals for Form20Row)
Map<Form20Row, Form20Row> rowsMap = results.stream().parallel().map(doc -> { Form20Row row = new Form20Row(); String propMark = propertyHelper.getNodeProp(doc, NDBaseDocumentModel.PROP_MARK); row.setGroupName(systemMessages.getString("form20.nss.name")); row.setDocMark(propMark); row.setDupesNumber(1); return row; }).collect(Collectors.toConcurrentMap(form20Row -> form20Row, form20Row -> form20Row, (existing, replacement) -> { int count = existing.getDupesNumber(); existing.setDupesNumber(++count); return existing; }));
Hi @iceja
I see from StackOverflow that you've updated your question. I that approach working for you?
Thanks,
My approach was to calculate dupes in Java collection (of results)
Hi @iceja,
Thanks for the update.
Best wishes,