WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
[resolved] Creating a custom search (4 posts)

  1. geerthoekzema
    Member
    Posted 1 year ago #

    Hi,

    I'm trying to create a custom search with relevanssi (free). I have several Custom Taxonomies (CT's). When a user searches for a keyword, he must be able to filter the search results from those CT's.

    Example:
    John searches for "keyword", he gets 100 results.
    In the sidebar there are filters which he can click (such as locations). When he clicks a certain location, all the results for 100 are checked and only the ones matching the location are returned.

    I do want to use relevanssi with this search, but somehow i cant seem to get it working. I can't find any documentation on this. I do assume that is has been done before.

    My question is:
    - where to start? Do I need to alter the wp_query via relevanssi_modify_wp_query filter?

    http://wordpress.org/extend/plugins/relevanssi/

  2. geerthoekzema
    Member
    Posted 1 year ago #

    Ok; found the solution.

    In short:

    1. create the ajax call's you want, and your custom query with new WP_query

    2. you can create a relevanssi search via: relevanssi_do_query($your_custom_wp_query);

    3. Dont forget to add the 's' field to your arguments for the wp_query();

  3. deutschwulf
    Member
    Posted 1 year ago #

    I'm trying to accomplish exactly the same thing, but I'm afraid that I'm having difficulty implementing it. I've tried:

    $args = array( 'meta_key' => '_year', 'meta_value' => '2010' );
    $the_query = new WP_Query($args);
    relevanssi_do_query($the_query);

    I've tried relevanssi_query_filter() as well with no luck at all. Could you please elaborate on the implementation of this?

    Thank you!

  4. geerthoekzema
    Member
    Posted 1 year ago #

    Hi Deutschwulf,

    I'm missing the search argument in your arguments. In order to get the search working you should add to your arguments: "s" => $_GET['s']

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.