How to check

  • LucaPescatore
    Participant
    4 years ago #19131

    Hello, I am trying to setup a Theme with WPSOLR and I would like to be sure that the Algolia index is used for the search and WP_Search is correctly used. How can I do that? The Theme seems doing a normal search and not in the Algolia Index.

    LucaPescatore
    Participant
    4 years ago #19132

    I investigated bit more

    I noticed that fhe part where is searching in the data is the following:

    $args = array(
    ‘tax_query’ => array($category,$job_salary,$title, $job_type,$job_category,$job_tags,$job_qualifications,$job_level,$job_skills,$job_experience,$job_currency,$job_shift,$job_class,$location,$location_keyword),
    ‘s’ => $title,
    ‘posts_per_page’ => get_option( ‘posts_per_page’ ),
    ‘post_type’ => ‘job_post’,
    ‘post_status’ => ‘publish’,
    ‘order’ => $order,
    ‘orderby’ => ‘date’,
    ‘paged’ => $paged,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘_job_status’,
    ‘value’ => ‘active’,
    ‘compare’ => ‘=’,
    ),
    $custom_search,
    $lat_lng_meta_query,
    ),
    );
    $args = nokri_wpml_show_all_posts_callback($args);

    $results = new WP_Query( $args );
    if ($results->found_posts > 0)
    {
    $message = __(‘Available Jobs’,’nokri’);
    PRINT “FOUND”;
    }
    else
    {
    $message = __(‘No Jobs Matched’,’nokri’);
    PRINT “EMPTY”;
    }

    Seems that the WP_Query is searching in the database than the Algolia index.

    Instead if I use the blog search I notice that the results are taken from Algolia.

    What can be wrong? As I understand the WP_Query should get the data from Algolia instead the mysql database.

    To check if the results are from Algolia or MySQL is because a specific keyword is only present in the Algolia index, therefore if the a single record is returned means that the data is retrieved from the Algolia index.

    wpsolr
    Keymaster
    4 years ago #19134

    WPSOLR is replacing archives, and only archives. If your search built its own search (search url is not like ?s=), then WPSOLR is not activated.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.