cancel
Showing results for 
Search instead for 
Did you mean: 

Freemarker search performance

simon
Champ in-the-making
Champ in-the-making
There are multiple ways to find documents or list a directory in a FreeMarker template:
<#list companyhome.childByNamePath["Data Dictionary/Presentation Templates"].children as child>
<#list companyhome.childrenByXPath["*[@cm:name='Data Dictionary']/*[@cm:name='Space Templates']/*[@cm:name='Software Engineering Project']/*"] as child>
<#list companyhome.childrenByLuceneSearch["TEXT:alfresco"] as child>
Are there important differences concerning the search performance?

Secondly I'm looking for a way to see if a folder contains documents in a FreeMarker template. Looping over all the documents and counting them to see if there are any seems silly and eats all my processing power.  Is there some better, more performant method to do this?
1 REPLY 1

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

In general, lucene based queries will be faster but they do not support full XPATH like predicates etc. The XPath implementation uses saxon and a model built on top of the node service. I would prefer lucene and use xpath when this is not possible, or when I know the set is well constrained - ie will not consider all nodes in the repo ….)

You could try folder.children.size   or do you want to exclude folders?

Regards

Andy