AnsweredAssumed Answered

HELP:Why same folders are in app and others in cm namespace?

Question asked by rafpgn on Feb 4, 2008
I'm encountering problems with lucene queries because i have not understood
Why same folders are in app namespace and why other folders are in the cm namespace ?

For example i have created 5 folders under Guest Home folder : A , B , C, D, E

so i dont understand why with the following lucene query i didnt get any results :

   PATH:"/app:company_home/app:guest_home/app:A"

results :
    query = PATH:"/app:company_home/app:guest_home/app:A"
    rows è null
    Exception in thread "main" java.lang.NullPointerException
       at org.alfresco.sample.webservice.LuceneQuery1.main(LuceneQuery1.java:67)
and why with the second query i get the information on the folder A :
   
    PATH:"/app:company_home/app:guest_home/cm:A"

results :
This is the complete code :

package org.alfresco.sample.webservice;

import org.alfresco.webservice.repository.*;
import org.alfresco.webservice.types.*;
import org.alfresco.webservice.util.*;

import java.io.*;
import java.net.*;
import org.alfresco.webservice.util.*;

//import org.alfresco.webservice.util.Constants;
public class LuceneQuery1
{
    public static void main(String[] args) throws Exception
    {
       AuthenticationUtils.startSession("admin","admin");
          try
       {
          RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
       
          Store store=null;
          Query query=null;
          boolean includeMetadata=false;
          store=new Store("workspace","SpacesStore");
          
          String queryStr="PATH:\"/app:company_home/app:guest_home/cm:A\"";

          //String queryStr="PATH:\"/app:company_home/app:guest_home/app:A\"";
          query=new Query(Constants.QUERY_LANG_LUCENE,queryStr);
          
          System.out.println("query = "+query.getStatement().toString());
          QueryResult queryResult =repositoryService.query(store,query,includeMetadata);
       
          if(queryResult==null)
             System.out.println("queryResult è null");
          
          ResultSet resultSet = queryResult.getResultSet();
          if(resultSet==null)
             System.out.println("resultSet è null");
          ResultSetRow[] rows = resultSet.getRows();
          if(rows==null)
             System.out.println("rows è null");
          
          System.out.println("numero di righe:"+rows.length);
          for (int x = 0; x < rows.length; x++)
          {
             ResultSetRow row = rows[x];
             System.out.println(row.getNode().getId());
             System.out.println(row.getNode().getType());
             
             NamedValue[] columns = row.getColumns();
                  for (int y = 0; y < columns.length; y++)
                  {
                     System.out.println("row " + x + ": "
                        + row.getColumns(y).getName() + " = "
                        + row.getColumns(y).getValue());
                  }
                  ResultSetRowNode node = row.getNode();
                  System.out.println("—————————————");
          }
       
        }
        finally
        {
            AuthenticationUtils.endSession();
        }
    }     
}

Thanks in advance.

Outcomes