<p>I want to figure out how to change our CRAFT CMS-built website's search functionality to deliver search results in descending chronological order. Currently, the oldest entries are at the top and people often don't scroll to the bottom. This has caused confusion for our organization. Any help would be greatly appreciated.</p>
<p>Running Craft CMS 3.7.38</p>

CC BY-SA 4.0
2022-06-21T19:52:49.187Z
Are you talking about a search implemented via code for your website or do you mean the Control Panel search?
Henrik
CC BY-SA 4.0
2022-06-21T19:54:20.313Z
I mean the search implemented code for the website
Erin 
CC BY-SA 4.0
2022-06-21T20:06:13.207Z
Can you provide some code how it is implemented? if you have this syntax {% set results = craft.entries().search(searchQuery).orderBy().all() %} ,you can change it then to this: .orderBy('postDate DESC').
Henrik
CC BY-SA 4.0
2022-06-21T20:10:56.227Z
Unfortunately, I didn't build the code, but am on the CMS side since I just joined the company. Trying to get access to the backend, but is there any shortcut on the CMS side to seeing the implementation? I know this is scope creep, but maybe i can then answer the question
Erin 
CC BY-SA 4.0
2022-06-21T20:14:57.347Z
to change the order you eventually need full access to the code, so i would guess the safest approach is to get access to the templates. can you get to the template via ftp?
Henrik
CC BY-SA 4.0
2022-06-21T20:23:37.473Z
Not currently. I am asking so I can go to the gatekeeper of the FTP and the code who says he cant change the search order and say, "You need to do X in order to change the search results." He has been saying that there's no way to change the order of the search results, but I know it's not true.
Erin 
CC BY-SA 4.0
2022-06-21T21:14:51.027Z
thats a though one. maybe best would be you get familiar on how one can implement a search, different strategies and get well prepared. good luck with the gatekeeper.
Henrik
<search>
Change search result order?
# Change search result order?

(Asked by: username_0 on 2022-06-21)

I want to figure out how to change our CRAFT CMS-built website's search functionality to deliver search results in descending chronological order. Currently, the oldest entries are at the top and people often don't scroll to the bottom. This has caused confusion for our organization. Any help would be greatly appreciated.

Running Craft CMS 3.7.38

**Tags:** search

> **Comments:**
> **username_1**: Are you talking about a search implemented via code for your website or do you mean the Control Panel search?  
> **username_0**: I mean the search implemented code for the website  
> **username_1**: Can you provide some code how it is implemented? if you have this syntax {% set results = craft.entries().search(searchQuery).orderBy().all() %} ,you can change it then to this: .orderBy('postDate DESC').  
> **username_0**: Unfortunately, I didn't build the code, but am on the CMS side since I just joined the company. Trying to get access to the backend, but is there any shortcut on the CMS side to seeing the implementation? I know this is scope creep, but maybe i can then answer the question  
> **username_1**: to change the order you eventually need full access to the code, so i would guess the safest approach is to get access to the templates. can you get to the template via ftp?  
> **username_0**: Not currently. I am asking so I can go to the gatekeeper of the FTP and the code who says he cant change the search order and say, "You need to do X in order to change the search results." He has been saying that there's no way to change the order of the search results, but I know it's not true.  
> **username_1**: thats a though one. maybe best would be you get familiar on how one can implement a search, different strategies and get well prepared. good luck with the gatekeeper.  

---

## 0 answers

