Lucene search for properties through Freemarker templates
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2006 12:42 PM
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
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:
Many thanks for the help,
Alex
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
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2006 02:06 PM
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:
So your final search string would look something like this:
Hope this helps,
Kevin
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 
@custom\\:Client:SampleClient
Hope this helps,
Kevin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2006 01:27 PM
Many thanks Kevin, this worked perfectly.
