• ngoclx

    (@ngoclx)


    Hi Mikko,

    I’m trying to:

    1. Increase the weight for newer posts to prioritize them in search results – This should be fixed with the premium version, right?
    2. Reduce the weight for older event posts, allowing more recent content to take precedence.
    3. Search for “starting with” instead of whole-words or just partial words

    Many thanks,

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

    (@msaari)

    Relevanssi Premium has a setting for 1., but you can also do it in code with the free version. See a couple of examples here.

    Reducing weight for old posts works the same way as adding weight to recent posts, and you can throw in a post type condition in there, that’s not a big deal.

    To get only “starting with” matches, set Relevanssi to do partial matching and then add this to your theme functions.php:

    add_filter( 'relevanssi_fuzzy_query', function( $query ) {
      return "(relevanssi.term LIKE '#term#%') ";
    } );
    Thread Starter ngoclx

    (@ngoclx)

    Excellent! Thanks for your reply!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add extra weight for newer posts, and reduce weight for old event posts’ is closed to new replies.