AnsweredAssumed Answered

SOLVED: SearchService and iso9075 problem

Question asked by shmoula on Jul 10, 2009
Latest reply on Jul 10, 2009 by shmoula
  I have following piece of code and it does very interesting things:

private Node getReportNode(Node noda) {
      String path = noda.getPath();

      path = path.replaceAll("\\{\\}", "app:");
      path = path.replaceAll("\\{\\}", "cm:");
      String query = "PATH:\"" + path + ".xml\"";

      StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
      ResultSet resultSet = getSearchService().query(storeRef, SearchService.LANGUAGE_LUCENE, query);

      for (ResultSetRow row : resultSet) {
         Node foundNode = new Node(row.getNodeRef());
         if (foundNode.hasAspect(ArchivaceModel.archProfileDescription))
            return foundNode;
      return null;

When I'm logged in as an Administrator, it works as expected. When I'm logged in as normal user, it does not work:

Unable to delete File due to system error: Failed to parse query: PATH:"/app:company_home/app:user_homes/{}xbalak00/cm:Profile/cm:kcab.png.xml"

So I found that I need to encode it as an ISO9075, I did:

String query = org.alfresco.util.ISO9075.encode("PATH:\"" + path + ".xml\"");

But it doesn't work, it finds nothing :-(. Where can be problem?

Thanks in advance!