Support » Plugin: Relevanssi - A Better Search » Creating a custom search

  • Resolved geerthoekzema

    (@geerthoekzema)


    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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();

    deutschwulf

    (@deutschwulf)

    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!

    geerthoekzema

    (@geerthoekzema)

    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’]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating a custom search’ is closed to new replies.