cancel
Showing results for 
Search instead for 
Did you mean: 

Problem on spaces creation

fracat71
Champ on-the-rise
Champ on-the-rise
Hi all,
i hava a main java class creating a spaces using foundation API with this method

private static NodeRef createFolder(ServiceRegistry serviceRegistry, NodeRef node, String name) {
      Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>();
      contentProps.put(ContentModel.PROP_NAME, name);
      contentProps.put(ContentModel.PROP_DESCRIPTION, name);      
      NodeService nodeService = serviceRegistry.getNodeService();
      ChildAssociationRef association = nodeService.createNode(node, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), ContentModel.TYPE_FOLDER, contentProps);
      return association.getChildRef();
}

when i try to search it with lucene - PATH:"/app:company_home/cmSmiley TonguearentSpace/*" i don't find it.

I have also a main java class creating a spaces using webservice API with this code

      ParentReference parentReference = new ParentReference(STORE, null, parentFolder, Constants.ASSOC_CONTAINS, Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, realfolderName));

         // Create folder
         NamedValue[] properties = new NamedValue[] { Utils.createNamedValue(Constants.PROP_NAME, realfolderNameRepalced), Utils.createNamedValue(Constants.PROP_DESCRIPTION, realfolderNameRepalced) };
         CMLCreate create = new CMLCreate("1", parentReference, null, null, null, Constants.TYPE_FOLDER, properties);
         
         CML cml = new CML();
         cml.setCreate(new CMLCreate[] { create });
         UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);

when i try to search it with lucene - PATH:"/app:company_home/cmSmiley TonguearentSpace/*" i find it.

Why the lucene search doesn't work (using foundation API creating the space)?

Regards,
Francesco
4 REPLIES 4

fracat71
Champ on-the-rise
Champ on-the-rise
Hi all,
i have a new.
After a lucene rebuild indexes (index.recovery.mode=FULL) the lucene search works.

How is it possible?
The main uses this kind of Transaction


   public static void main(String[] args) {
      start();
   }

   private static void start() {
      
      // initialise app content
      ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
      // get registry of services
      final ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);

      // use TransactionWork to wrap service calls in a user transaction
      TransactionService transactionService = serviceRegistry.getTransactionService();
      RetryingTransactionCallback<Object> exampleWork = new RetryingTransactionCallback<Object>() {
         public Object execute() throws Exception {
            doExample(serviceRegistry);
            return null;
         }
      };
      System.out.println("Prepare to commit");
      transactionService.getRetryingTransactionHelper().doInTransaction(exampleWork);
      System.out.println("Commit executed");
      System.exit(0);
   }

Regards,
Francesco

fracat71
Champ on-the-rise
Champ on-the-rise
Hi all,
step by step i'm answering to my question.
First of all only a stop/start is needed because i'm runnning a main.
Another problem is the ISO9075 for blank spaces, blank space = _x0020_ .

Francesco

fracat71
Champ on-the-rise
Champ on-the-rise
Hi all,
is it not true the problem is not solved.
When i try to access using a lucene query the space is not found.
Space created using a java main.

This is the result of Node Browser Luncene Query

Search Search Language: lucene
Search: PATH:"/app:company_home/cm:Enti/*"

Results (1 rows) Name Node Parent
AAA workspace://SpacesStore/92cce1ce-0fb6-4a75-8719-29b15a329404 workspace://SpacesStore/6bb1171e-3c07-4cb5-b526-141638dee581


This is the result of Node Browser with the access to /app:company_home/cm:Enti/

Children Child Name Child Node Primary Association Type Index
I Ufficio Ciampino workspace://SpacesStore/0b0eb4a5-453c-4720-8929-8888b1d6199a true contains 0
AAA workspace://SpacesStore/92cce1ce-0fb6-4a75-8719-29b15a329404 true contains 1


Regards,

fracat71
Champ on-the-rise
Champ on-the-rise
Hi all,
i find the solution the problem was the main, in fact the code runs as an Action works.

Regards