AnsweredAssumed Answered

Search through subspaces within a space...

Question asked by sri on Jan 5, 2009
Latest reply on Jan 27, 2009 by zaizi
Hi,

I'm absolutely new to Alfresco and Lucene.
Could someone please tell me how to search through all subfolders within a folder (all subspaces in a space).

Was trying to run Query2.java in SDK Webservices sample by modifying the sample code as follows:

Reference reference = new Reference(STORE, null, "/app:company_home/cm:App1/cm:SP1/cm:Doc2\"");
Predicate predicate = new Predicate(new Reference[]{reference}, null, null);       
Node[] nodes = repositoryService.get(predicate);

Query query = new Query(Constants.QUERY_LANG_LUCENE,"+PARENT:\"workspace://SpacesStore/"+ node.getReference().getUuid() + "\" +TEXT:\"" + searchValue + "\"");

This worked fine and returned all files within Doc2 folder which matched the search text.

Inorder to search through all subspaces within "Subprocess1", I tried the following but did not succeed…
1. Reference reference = new Reference(STORE, null, "/app:company_home/cm:App1/cm:Subprocess1//*\"");

2. Reference reference = new Reference(STORE, null, "/app:company_home/cm:App1/cm:Subprocess1/@cm\":name:Doc*\"");

3. Query query = new Query(Constants.QUERY_LANG_LUCENE, "+PATH:/app:company_home/cm:App1/cm:Subprocess1//*\"+TEXT:\"" + searchValue + "\"");

Please help!!

Outcomes