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 ?
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).
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 ?
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.
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.
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>
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.