• Resolved problematichild

    (@problematichild)


    Hi, I’ve been trying to implement did you mean functionality to the site, I enabled the query logging and added this code https://prnt.sc/Jq4bvUed-_FL on search.php just before have_posts() https://prnt.sc/s8_oP5gVxeBh however it doesn’t seem to work. I’m not quite sure if I’m missing something.

    Also, how does did you mean function pull suggestions from the query log?

    Any help is appreciated, Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    The code is correctly placed. It’s possible it’s just not able to come up with good suggestions yet.

    First Relevanssi fetches all queries from the log that have found at least 3 results. This data is cached for a month because it’s a fairly heavy query. You can try clearing the cache with this:

    delete_transient( 'relevanssi_didyoumean_query' );

    Add this to your theme functions.php to force Relevanssi to load the queries from the log, then you can comment the line out or remove it, having it run on every search is going to slow things down.

    Then Relevanssi compares the search query to the queries in the log using the Levenshtein distance and if it finds something sufficiently close, that will be offered as a suggestion.

    This isn’t a terrific method; there’s a better one in Relevanssi Premium, based on the actual contents of your site.

    Thread Starter problematichild

    (@problematichild)

    Hi @msaari it seems to be working now, thank you so much for your help. We will consider the premium version after testing the free version for a couple of days.

    Once again thank you and have a great day!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Did you mean feature’ is closed to new replies.