cancel
Showing results for 
Search instead for 
Did you mean: 

Find users with Lucene query using QName

abarisone
Star Contributor
Star Contributor
Hi all,
I'm trying to get the list of all users belonging to a certain group using a Lucene query.
Placing it into Alfresco Node Browser as:

TYPE:"cm:person" AND @cm\:userName:"*" AND QNAME:"sys:system/sys:authorities/cm:GROUP_USR_0000011046/*"

I correctly obtain all the users for that group.
But when trying to use it into the Alfresco debugger as:

search.luceneSearch("workspace://SpacesStore","TYPE:\"cm:person\" AND @cm\\:userName:\"*\" AND QNAME:\"sys:system/sys:authorities/cm:GROUP_USR_0000011046/*\"","@cm:userName",true)
%

I get this error:
    Wrapped org.alfresco.error.AlfrescoRuntimeException: 07230052 Failed to execute search: TYPE:"cmSmiley Tongueerson" AND @cm\:userName:"*" AND QNAME:"sys:system/sys:authorities/cm:GROUP_USR_0000011046/*"
Can anybody help me about this issue?
Thanks a lot!!!
5 REPLIES 5

andy
Champ on-the-rise
Champ on-the-rise
Hi

I am not sure why you have your issue:

But the clause

@cm\:userName:"*"        has no point as the property is mandatory for the type.

and you are abusing QNAME.
It happens to be implemented as PATH:"//<QNAME>" - you would be better using PATH as you are not just using a qname - then you cna avoid the "//" at the start.

Andy

andy
Champ on-the-rise
Champ on-the-rise
Hi

Are you using the same query language?
What is the full exception?

Andy

abarisone
Star Contributor
Star Contributor
Hi,
the strange thing is that trying with both QName and Path it works on the node browser.
But it doesn't with alfresco debugger.
Moreover the message I provided is the only message I obtain from alfresco debugger.
What am I doing wrong?
Which is the correct way to write the lucene query?
Thanks.

scouil
Star Contributor
Star Contributor
Hi,

I'm sorry I have no idea what's wrong with the syntax so I may not be useful at all but…
Is there a good reason why you're not using:
people.getMembers(people.getGroup("GROUP_USR_0000011046"));

instead of a lucene query?

abarisone
Star Contributor
Star Contributor
Thank you for your reply.
The main reason I would like to use a Lucene query is to have a "one-shot" response.
Moreover this approach would be more flexible, especially when comes out the need of changing the query criteria.
I can't yet figure out why the search works well with the Alfresco node browser but not in debugger/code….