I've managed to get Osclass to search by Relevance, but...
« on: November 08, 2025, 11:30:22 PM »
I've managed to sort by relevance by modifying the hSearch.php and model/Search.php files in the core, but now the default search is sOrder=pub_date&OrderType=desc. How can I change the default to sOrder=relevance&OrderType=desc?




*

MB Themes

Re: I've managed to get Osclass to search by Relevance, but...
« Reply #1 on: November 11, 2025, 10:32:27 AM »
Reference what is default is in core - model or controller, that checks if no sort selected, use dt_pub_date.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: I've managed to get Osclass to search by Relevance, but...
« Reply #2 on: November 13, 2025, 10:44:58 PM »
Reference what is default is in core - model or controller, that checks if no sort selected, use dt_pub_date.

I've set it to Relevance by default in the helpers/hPreference file like this: I replaced this
Code: [Select]
function osc_default_order_field_at_search() {
return (getPreference('defaultOrderField@search'));
}
  with this
Code: [Select]
function osc_default_order_field_at_search() { 
return 'relevance';
// We force 'relevance' as the new default value!
and it works perfectly, but when I later select most recent in the search, it switches to Relevance. If you want, I can send you the URL of my website privately so you can see it. Sorry for my English; I'm using Google Translate :)
« Last Edit: November 14, 2025, 08:03:15 AM by Dani Rucabado »

*

MB Themes

Re: I've managed to get Osclass to search by Relevance, but...
« Reply #3 on: November 14, 2025, 10:10:21 AM »
Ok but osclass don't know what "sort by relevance" means so in best case you get data sorted by nothing and you can hope it means relevance.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots