cancel
Showing results for 
Search instead for 
Did you mean: 

[RESOLVED] SearchService issue with Alfresco 3.0 SP1

lascaux
Champ on-the-rise
Champ on-the-rise
Hi,

I'm trying to get a space based on its path.
for example, if the folder path is /app:company_home/cm:MyProject/cm:Folder (I confirmed the path is correct getting it from the nodeRef using its uuid)
I perform the following :
ResultSet lResultSet = searchService.query(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"), SearchService.LANGUAGE_LUCENE, "+PATH:\"/app:company_home/cm:MyProject/cm:Folder\"");
this query raised a null Exception

I tried several query and all are raising a null exception (hard to debug with no indication) such as
ResultSet lResultSet = searchService.query(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"), SearchService.LANGUAGE_LUCENE, "+@cm\\:name:Folder +PATH:\"/app:company_home/cm:MyProject\"");

If someone can help me …

Thanks

Sylvain
5 REPLIES 5

jayjayecl
Confirmed Champ
Confirmed Champ
I think Lucene path queries do not support prefixes (as app:, or cmSmiley Happy

Try to use full URI instead.

Hope it helps

lascaux
Champ on-the-rise
Champ on-the-rise
Thanks a lot ! it works !!!!

many examples show that the previous query was supposed to work …

I will know that now Smiley Happy

lascaux
Champ on-the-rise
Champ on-the-rise
Hello,

in fact, it is still not working …
with the full URI prefix {http://www.alfresco.com/model…) rather than the named prefix (cmSmiley Happy, I got one result (rather than an exception) …
but after more investigation, the result is wrong.
It only returns me the root of the repository (/) (parent of company_home)

Is there a way, like with the webservice, to get a node using its path ?
in the API documentation, search was the solution presented, but it is not working (is it a bug in Alfresco 3.0 SP1 ?)

Thanks for your help

Sylvain

rogier_oudshoor
Champ in-the-making
Champ in-the-making
You can absolutely use prefixes such as app: and cm: in path queries. The hard part is however getting the syntax right. You probably made an error in your search syntax. Just try typing
PATH:"/app_company_home"
in your node browser lucene search and see what happens. If this works, try your own queries here Smiley Wink

In hindsight, it may have something to do with your "+" in front of each query item too.

lascaux
Champ on-the-rise
Champ on-the-rise
I stopped trying to use the search query to get a folder.
I used the selectNodes … and it resolved my issue Smiley Happy

thx to all