Hi All,
Currently Advanced Search result is being sorted based on Relevance by default.
Now, I want it to change with Modified Date. How can I achieve this?
Thanks,
Yash
Changing the order in share config should work. I have not tested so not completely sure.
Default:
<config evaluator='string-compare' condition='Search'>
<search>
<sorting>
<sort labelId='search.sort.relevance'></sort>
<sort labelId='label.name'>cm:name</sort>
<sort labelId='label.title'>cm:title</sort>
<sort labelId='label.description'>cm:description</sort>
<sort labelId='label.author'>cm:author</sort>
<sort labelId='label.modifier'>cm:modifier</sort>
<sort labelId='label.modified'>cm:modified|false</sort>
<sort labelId='label.creator'>cm:creator</sort>
<sort labelId='label.created'>cm:created|false</sort>
<sort labelId='search.sort.size'>.size|true</sort>
<sort labelId='search.sort.mimetype'>.mimetype</sort>
<sort labelId='search.sort.type'>TYPE</sort>
</sorting>
</config>
Try changing to:<!-- The 'sort' config element contains the name of the content model
Field to sort against and can be of the form: .
Short QName string e.g. "cm:name".
Pseudo cm:content field starting with a "." e.g. ".size".
Any other valid sortable fts-alfresco special field e.g. "TYPE".
The field can be optionally followed by |true or |false to indicate sort direction,
where true = ascending, false = descending.
The element supports the following optional attributes:
label = label text to display
labelId = I18N message id of label text to display
isSortable = true or false for if the field contains sortable data -->
<config evaluator='string-compare' condition='Search'>
<search>
<sorting>
<sort labelId='label.modified'>cm:modified|false</sort>
<sort labelId='search.sort.relevance'></sort>
<sort labelId='label.name'>cm:name</sort>
<sort labelId='label.title'>cm:title</sort>
<sort labelId='label.description'>cm:description</sort>
<sort labelId='label.author'>cm:author</sort>
<sort labelId='label.modifier'>cm:modifier</sort>
<sort labelId='label.creator'>cm:creator</sort>
<sort labelId='label.created'>cm:created|false</sort>
<sort labelId='search.sort.size'>.size|true</sort>
<sort labelId='search.sort.mimetype'>.mimetype</sort>
<sort labelId='search.sort.type'>TYPE</sort>
</sorting>
</config>
This is an old post but may be helpful: https://community.alfresco.com/docs/DOC-6015-share-repository-search-improvements
It works with a couple of little changes in the xml.
<config replace="true" evaluator='string-compare' condition='Search'>
<sorting>
<sort labelId='label.modified'>cm:modified|false</sort>
<sort labelId='search.sort.relevance'></sort>
<sort labelId='label.name'>cm:name</sort>
<sort labelId='label.title'>cm:title</sort>
<sort labelId='label.description'>cm:description</sort>
<sort labelId='label.author'>cm:author</sort>
<sort labelId='label.modifier'>cm:modifier</sort>
<sort labelId='label.creator'>cm:creator</sort>
<sort labelId='label.created'>cm:created|false</sort>
<sort labelId='search.sort.size'>.size|true</sort>
<sort labelId='search.sort.mimetype'>.mimetype</sort>
<sort labelId='search.sort.type'>TYPE</sort>
</sorting>
</config>
Tested in Share 5.2
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.