AnsweredAssumed Answered

problem with lucene querys and content creations

Question asked by magno on Jul 23, 2010
I've a problem which i can't find the error. I'm developing some portlet for liferay to access alfresco in a liferay portal
I have a portlet in Java which create a document in alfresco using Web services API, like that:
 Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");  
             ParentReference companyHomeParent = new ParentReference(storeRef, null, "/app:company_home", Constants.ASSOC_CONTAINS, null); 
             companyHomeParent.setChildName("cm:" + name);
              NamedValue[] contentProps = new NamedValue[1];  
             contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, name);  
             CMLCreate create = new CMLCreate("1", companyHomeParent, null, null, null, Constants.TYPE_CONTENT, contentProps); 
             NamedValue[] titledProps = new NamedValue[2]; 
             titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, titulo); 
             titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, descripción); 
             CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED, titledProps, null, "1");
             CML cml = new CML(); 
             cml.setCreate(new CMLCreate[] {create}); 
             cml.setAddAspect(new CMLAddAspect[] {addAspect}); 
             UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml); 
             Reference content = result[0].getDestination();
             ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService(); 
             String text = textoHTML; 
             // hay que darle el formato segun el tipo!!!
             ContentFormat contentFormat=null;
             if (tipo.equalsIgnoreCase("html")){
                contentFormat = new ContentFormat("application/msword", "UTF-8");
             if (tipo.equalsIgnoreCase("txt")){
                contentFormat = new ContentFormat("plain/text", "UTF-8");
             if (tipo.equalsIgnoreCase("pdf")){
                contentFormat = new ContentFormat("application/pdf", "UTF-8");
             contentService.write(content, Constants.PROP_CONTENT, text.getBytes(), contentFormat); 
Thers no problem with that method, which create the document well in the repository. Although, when I go to another portlet which is search portlet, It only find the documents that i've created in alfresco directly, not those which i've created manually. I think that it has to be some that i don't know and I've to especify when I create a new document, in order to later can be searched by this query:
      String luceneQuery ="@cm\\:name:"+name+"" ;
         Query query = new Query("lucene", luceneQuery);      
         Store storeRef = new Store("workspace", "SpacesStore");

I'm desperated with this problem. I hope someone can help me. Sorry for my horrible English