cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco JCR xpath search

koivimik
Champ in-the-making
Champ in-the-making
I've quite successfully used the Alfresco JCR-JNDI Bridge found in Jira.

My problem is with QueryManager xpath query performance. It seems that no matter how simple query I make it always takes around 30 seconds to complete which is completely unacceptable.

Here is a sample query //app:company_home/dws:Folder1/dsw:Folder2/element(*, dws:article)

dws:Folder1 and dws:Folder2 are custom model types that extend cm:folder and dws:article is a custom type that extends cm:content

dws:Folder2 has 6 items.

I found this old forum post http://forums.alfresco.com/viewtopic.php?t=1908 about bad query performance. Hasn't there been done anything for this in 18 months. Is Alfresco ever going to commit to JCR or is it just marketing bullXXXX for managers that don't know better?

BTW Why isn't the JCR-JNDI bridge made part of official Alfresco release? There is no use for JCR API you can't get to from other apps running in same jvm but different webapp.
6 REPLIES 6

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

Some XPATH queries will be slow. The implementation walks the repo with some optimisations.

The example path query starts with // so will consider all nodes in the repo. There is no reason for // in the query. So you can remove it and it will be a lot faster.

Andy

koivimik
Champ in-the-making
Champ in-the-making
Hi Andy!

Thanks for replying. I've tried to use the query without // but it always results in 0 results.

Query app:company_home yields 1 result as does /app:company_home now if I query app:company_home/dws:Folder1 I get 0 results same with /app:company_home/dws:Folder1. It really doesn't matter what I put after app:company_home since I always get 0 results. Putting // before app:company_home always yields correct amount of results but the performance of the query is poor.

kevinr
Star Contributor
Star Contributor
Are you sure your path is correct? As if you get 0 results it's probably not.

Thanks,

Kevin

koivimik
Champ in-the-making
Champ in-the-making
Well you tell me! I think it should be. If I have a folder called Folder1 with ns dws under the Company Home shouldn't the absolute path be /app:company_home/dws:Folder1 ?

szpakoo23
Champ in-the-making
Champ in-the-making
Hello,

This path is still relative against spaces.
Try to add prefix "/alf:space" instead of "//"

jzhang2007
Champ in-the-making
Champ in-the-making
You might want to try vtd-xml for the best xml parsing/xpath performance

http://vtd-xml.sf.net