• Hello, I just installed the plugin to get rid of the slow WP integrated search engine.

    1- When I tick “Enable mySQL FULLTEXT searching” query result display is very fast (less than one second on a 100.000+ articles site) But results show up by “relevancy”, though I don’t understand its logical.

    2- When I UNtick “Enable mySQL FULLTEXT searching” results show up by date but it is very slow (as the native WP search engine).

    So, is there a way to display by DATE with ticking the “Enable mySQL FULLTEXT searching”? ??

    Thank you!

Viewing 1 replies (of 1 total)
  • Plugin Author Ajay

    (@ajay)

    You’d need to put a function using Code Snippets plugin, or your theme’s functions.php to force this.

    This could work – please can you try it. Backup ideally before making changes.

    function wporg_bsearch_posts_orderby( $orderby, $query ) {
    	global $wpdb;
    
    	if ( $query->is_search() ) {
    		$orderby = " $wpdb->posts.post_date DESC ";
    	}
    
    	return $orderby;
    }
    add_filter( 'posts_orderby', 'wporg_bsearch_posts_orderby', 11, 2 );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Sorting results by date?’ is closed to new replies.