cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene search for properties through Freemarker templates

alexp
Champ in-the-making
Champ in-the-making
Hi there,

Hopefully a quick question about using Lucene to search for content within a template.

I am trying to find documents by searching only their assigned properties. For example, our content model provides a property called "Client". I need to find all content items which have a Client of "SampleClient".

Trying something like
companyhome.childrenByLuceneSearch["Client:SampleClient"]‍

does not return any results.

FYI, the whole template is the following and counts the number of documents returned. It works fine for simple text search:

<#assign x>  <#list companyhome.childrenByLuceneSearch["TEXT:public"] as n>    alex  </#list></#assign>Number of docs: ${x?word_list?size}‍‍‍‍‍‍

Many thanks for the help,
Alex
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
The search you have attempted is malformed - take a look at the section on searching for specific properties here:
http://wiki.alfresco.com/wiki/Search#Finding_nodes_by_text_property_values
You need to know the namespace prefix of your property from your custom model, assuming the namespace prefix was "custom" then the search string would look like this:
@custom\:Client:SampleClient‍‍‍
Note that you need to escape the '\' character as it's also an escape character in FreeMarker Smiley Happy So your final search string would look something like this:
@custom\\:Client:SampleClient‍‍‍

Hope this helps,

Kevin

alexp
Champ in-the-making
Champ in-the-making
Many thanks Kevin, this worked perfectly.
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.