Alfresco version: 3.1 SP1All this is fairly new to me, so hoping that someone here might help out.I have a custom type called bla:jobI'm trying to search and collect all data/properties based on that type, so that in my JSON ftl I can call on the properties I need.Following code is a very simple draft of how I'm trying step by step to accomplish this. I prefer using the Lucene way as that is recommended here and there for doing this kind of search by type.This is my search.get.js
function main()
{
var results = search.luceneSearch("TYPE:\"{http://www.mysite.nl/model/content/1.0}job\"");
logger.log(">>>>>>>>>>>>>>>NODE LENGTH:" + results.length);
model.results = results;
}
main();
The logger gives me "3" and that's correct; I have 3 content items of that type.This is my search.get.json.ftl
[
<#if results?exists>
<#– This works, specifying the first item in the array, just a test –>
"jobtype" : "${results[0].properties["bla:jobtype"]}"
<#– Now this is where it gets "weird" for me at least –>
<#list results as result>
{
${result}
${result_index}
<#– This does NOT work, the bla:jobtype property is a custom property from my custom model –>
<#– "jobtype" : "${result.properties["bla:jobtype"]}" –>
<#if result_has_next>,</#if>
}
</#list>
</#if>
]
I CAN call a standard Alfresco property like name, though by doing result.name or even result.properties.name.This is my JSON output based on above code:
[
"jobtype" : "Accountant"
{
Node Type: {http://www.mysite.nl/model/content/1.0}job Node Ref: workspace://SpacesStore/f1371de1-a1c0-461b-b863-f89fbd535953
0
,
}
{
Node Type: {http://www.mysite.nl/model/content/1.0}job Node Ref: workspace://SpacesStore/5bf98860-e93f-4cfd-8e9d-a177076abc65
1
,
}
{
Node Type: {http://www.mysite.nl/model/content/1.0}job Node Ref: workspace://SpacesStore/bd3aaf7b-0d2d-454b-bc0c-bb54c808739c
2
}
]
As you can see, the index returns correct amount of items (3), but is the data in the model correct? I thought so, because if i do the search based on XPATH in my .js file, I get the exact same JSON output and the result.properties["customProperty"] does work then!The only difference is that when doing it by XPATH the query is based on one of the properties within that type:
var results = companyhome.childrenByXPath("*//.[@bla:topjob='true']");
Again, JSON output is exactly the same, it's only with the Lucene way I don't know how to access my custom properties within the <#list> directive.Not minding the awfully simple and sloppy code, is there someone who can help?Tnx.