cancel
Showing results for 
Search instead for 
Did you mean: 

Search through subspaces within a space...

sri
Champ in-the-making
Champ in-the-making
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!!
3 REPLIES 3

cleseach
Star Contributor
Star Contributor
Hi,

but did not succeed…
Did you get some error message that could help us finding the problem ?

By the way, tests 1) and 2) can't work : you should give a path as third argument of Reference, and not pattern.
Test 3) should be OK if you add a space before +TEXT.
A good practice is to test queries with node browser when they don't work "programmatically".

Regards,
Charles Le Seac'h

sri
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to use OpenSearch for searching through subspaces within a space……

How and where can I define the path where the following query will be executed??

http://<host>:<port>/alfresco/service/api/search/keyword?q={searchTerms}&p={startPage?}&c={count?}&l={language?}

Looking foward to your help…

Thanks in advance
Sri

zaizi
Champ in-the-making
Champ in-the-making
The OpenSearch specification does specify restricting search to folders. To answer your question, you can't restrict it to subspaces using OpenSearch.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.