AnsweredAssumed Answered

lucene search for one file

Question asked by mangar on Jul 8, 2010
Latest reply on Jul 8, 2010 by mangar
I am trying to add/update a file in Alfresco.  In order to do this I need to see if the file is already in alfresco so I can choose either CMLCreate vs CMLUpdate. I have been through the wiki tutorial, and i try this search:

(yes, the directory is called myReport, and in that space, the file myReport.xls resides.)

it returns nothing, but it's there. I can see it.

I know the path and the name of the file, what is the correct lucene search to return a ResultSet for that file?

Alternatively, is there any code example that would do this:

ParentReference contentReference = new ParentReference(storeRef,null,path,ASSOC_CONTAINS,ASSOC_CONTAINS);
CMLCreate createDoc = new CMLCreate("ref1", contentReference, null, null, null, Constants.createQNameString(NAMESPACE, "report"), contentProps);
cml.setCreate(new CMLCreate[]{createDoc});
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
Reference newContentNode = result[0].getDestination();
ContentFormat  format = new ContentFormat("application/excel", "UTF-8");
WebServiceFactory.getContentService().write(newContentNode, Constants.PROP_CONTENT, bytes, format);

without that annoying  "Duplicate child name not allowed"