AnsweredAssumed Answered

WebScript write and read gap

Question asked by modestas on Dec 3, 2014
Latest reply on Dec 5, 2014 by modestas
Hello,

I am experiencing quite annoying problem with writing and search for the object..

If you write something to alfresco on first request and try to read it (search for it) on another request.
You might not find it. You will experience something like a gap…

Writing example:

                NodeRef rootNode = nodeService.getRootNode(getStoreRef());
      NodeRef parentNode = documentSearchService.findNode(locationPath, rootNode);

      Map<QName, Serializable> properties = new HashMap<>();

      String documentName = newDocument.getName();
      properties.put(Model.PROP_NAME, documentName);


      return nodeService.createNode(parentNode, Model.ASSOC_CONTAINS, getQName(documentName), Model.TYPE_DOCUMENT, properties).getChildRef()


Searching example:

                SearchParameters sp = new SearchParameters();
      sp.addStore(getStoreRef());
      sp.setLanguage(SearchService.LANGUAGE_LUCENE);
      sp.setQuery(query);
      ResultSet results = null;
      try
      {
         results = searchService.query(sp);
         if (results != null)
         {
            return results.getNodeRefs();
         }
      }
      finally
      {
         if (logger.isDebugEnabled())
         {
            logger.debug("Executed query :" + query);
         }
         if (results != null)
         {
            results.close();
         }
      }


<strong>So my question is how to solve gap problem of writing and searching for that object?</strong>

respectfully,
Modestas

Outcomes