Support » Plugin: Relevanssi - A Better Search » How to implement Relevanssi with my custom Search query

  • Hello,

    I am using a custom search query on a custom Post Type (Course) using code like this –
    $wp_query = new WP_Query($args);

    Now, how to implement Relevanssi with my search result?

    • This topic was modified 1 year, 5 months ago by  ayandebnath.
    • This topic was modified 1 year, 5 months ago by  ayandebnath.

    The page I need help with: [log in to see the link]

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

    (@msaari)

    relevanssi_do_query($wp_query);

    That’s it.

    Thanks I am exactly doing this. But I am facing a strange problem.

    In my custom posts (Course), its has a custom Taxonomy (Course-Category).
    When someone puts some search keywords, the search is working fine.
    But when someone, not giving any search keywords, and only selecting the category, the search result in returning ZERO result!!

    What I am doing wrong?

    Plugin Author Mikko Saari

    (@msaari)

    You’re using Relevanssi for something Relevanssi isn’t there. Relevanssi is a full-text search, and if there’s no search term, it can’t find anything. Nothing can be relevant, if there’s no search term to use for determining relevancy.

    If you want to use Relevanssi without a search term, then yeah, you can do that, but it means Relevanssi won’t be actually doing much, and you have to write the code that finds the right posts yourself.

    Here’s a pretty good example of what you need: https://www.relevanssi.com/knowledge-base/using-relevanssi-without-a-search-term/

    See the “Falling back to native WordPress search” bit at the end of the post.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to implement Relevanssi with my custom Search query’ is closed to new replies.