06-04-2019 06:48 AM
Hello,
I use smart folders to query my files and everything works fine, with the following json code :
"nodes" : [{
"id":"111",
"name" : "...",
"search" : {
"language" : "fts-alfresco",
"query" : "=ns:field1:'value' and =ns:field2:'value' and =ns:field3:'value'"
}
}]
Now, I try to order the results by field4 but nothing works :
"nodes" : [{
"id":"111",
"name" : "...",
"search" : {
"language" : "fts-alfresco",
"query" : "=ns:field1:'value' and =ns:field2:'value' and =ns:field3:'value'"
},
"sort" : [
{"column" : "ns:field4"}
]
}]
I used https://docs.alfresco.com/5.0/references/API-JS-query.html to find the code... But i don't know if I can order my files by using fts-alfresco language. How can I solve this please ?
06-04-2019 10:40 AM
Typically the sort column needs to be specified with an @ in front of the name. Also, make sure your custom field is indexed and uses either tokenisation mode "false" or "both" (unless you can guarantee your query will be executed by the DB).
06-05-2019 03:32 AM
Thanks for you answer but it is still not working.
My property is the following :
<property name="ns:title">
<title>Title</title>
<type>d:text</type>
<mandatory>true</mandatory>
<index enabled="true">
<tokenised>false</tokenised>
<facetable>false</facetable>
</index>
</property>
I tried the following sorts : "@ns:title", "@{ns}title", "@{http://www.company.org/model/ns/content/1.0 }title"
What is the exact format expected ?
06-05-2019 02:56 PM
AFAIK, there is no "sort" property for the Smart Folder configuration file (Smart Folder Template syntax | Alfresco Documentation)
Besides that, I believe it would not make sense to have it, as the sort order will be defined by the Share's document library component.
Please, correct me if I am wrong.
06-05-2019 04:28 PM
Right - I did not think of that. See https://docs.alfresco.com/5.2/concepts/sf-ref-template-guidance.html for details about the syntax.
06-06-2019 04:12 AM
Thank you, I will stop to search for nothing !
The sort option for DocumentLibrary works well, I can see the sort option in the list
<config evaluator="string-compare" condition="DocumentLibrary">
<sorting>
<sort label="label">ns:field</sort>
</sorting>
</config>
Explore our Alfresco products with the links below. Use labels to filter content by product module.