How to change by default sorting of advanced search result

cancel
Showing results for 
Search instead for 
Did you mean: 
Established Member

How to change by default sorting of advanced search result

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

2 Replies
Moderator
Moderator

Re: How to change by default sorting of advanced search result

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

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)
Active Member

Re: How to change by default sorting of advanced search result

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