Topics

Tribe Support

Tribe Support's Topics

Mohamed Abdi

2 weeks ago

How do we modify the order of the results for a global search?

Hi Rastin Mehr, I wanted to know how the profiles that are result of a global search can be ranked by modifying the php class that handles the database query.  I want to be able to display the results of a string search in way that orders them by database attributes of said profile e.g. show the profiles of users in the same city first. 

Thanks Mo

PS Can you tell us the path of that php file?
The search is handled by the com_search component. More than one classes are involved to make the search happen. The query class is here:

https://github.com/anahitasocial/anahita/blob/master/src/components/com_search/domains/queries/node.php

and of course this is the controller https://github.com/anahitasocial/anahita/blob/master/src/components/com_search/controllers/search.php

I don't recommend touching any of those files. The com_search is functioning independently which means you can choose to build your own alternative com_search or com_searches and implement your own unique logic. Right now if you pass the nearby parameters the results will be filtered based on the viewer's obtained location. Isn't that enough for your purpose?

Powered by Anahita