WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
[resolved] Filter on the "Did you mean?" query (6 posts)

  1. John Blackbourn
    Member
    Posted 3 years ago #

    Hi Mikko,

    Would it be possible to add a filter to the SQL query inside the relevanssi_didyoumean() function? I'd like to tweak the query via my plugin without having to modify the Relevanssi plugin.

    For example, this would be great:

    $sql = apply_filters( 'relevanssi_didyoumean_query', "SELECT query, count(query) as c, AVG(hits) as a
    		FROM $log_table WHERE hits > 1 GROUP BY query ORDER BY count(query) DESC", $query );
    	$data = $wpdb->get_results( $sql );

    Cheers!

    John

  2. Mikko Saari
    Member
    Plugin Author

    Posted 3 years ago #

    Certainly, I like adding filters whenever I get good ideas of where to add them. Feel free to use this change, it'll become official in the next version.

  3. Mikko Saari
    Member
    Plugin Author

    Posted 3 years ago #

    This is now in 2.7.2.

  4. jefflennan
    Member
    Posted 3 years ago #

    Should the "did you mean" functionality automatically occur if you have logs turned on? I am not getting that feature and cant find where to "turn it on"

    Thanks for any guidance.

    Jeff

  5. jefflennan
    Member
    Posted 3 years ago #

    Should the "did you mean" functionality automatically occur if you have logs turned on? I am not getting that feature and cant find where to "turn it on"

    Thanks for any guidance.

    Jeff

  6. Mikko Saari
    Member
    Plugin Author

    Posted 3 years ago #

    No, you need to add a bit of code on your search results page to see the suggestions. Take a look at the plugin FAQ, the instructions are there.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags