• Resolved jenkinsmi

    (@jenkinsmi)


    Hey we have weights set at 0.1 for content and 50 for title, however searching the term ‘Mobile Decanting Unit’, that product shows up low down in the reusults. Number 1 in the result simply has the word ‘unit’ in its content 8 times.

    To try and avoid the problem entirely, I added this in my functions.php, however this has not stopped indexing of content, strange.

    add_filter( ‘relevanssi_index_content’, ‘__return_false’ );

    Let me know what you think on both issues.

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

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

    (@msaari)

    Does the Relevanssi admin search (Dashboard > Admin search) get you the correct results? It seems to me it’s possible the search isn’t Relevanssi in the first place. The search doesn’t respond to changing the order, for example.

    Do you use FacetWP or other tools like that? What does your theme search results template look like?

    Thread Starter jenkinsmi

    (@jenkinsmi)

    Hmm that’s interesting as our search results definitely changed after we added relevanssi, but it sounds like you are right as the admin search results gets the correct results.


    The way I am doing the relevannsi search in my search-product.php, I found the relevanssi_do_query at https://www.relevanssi.com/user-manual/functions/relevanssi_do_query/:

    $args = array(

                    ‘orderby’ => ‘menu_order’,

                    ‘order’ => ‘ASC’,

                    ‘post_type’ => ‘catalogue’,

                    ‘s’ => $search_query

    );

    $query ? ? ? ? ? ? ? ? ? ?= new WP_Query( $args );

    $query->parse_query( $args );

    relevanssi_do_query( $query );

    Plugin Author Mikko Saari

    (@msaari)

    Ah, there’s the explanation: you’re sorting the posts by menu_order , which means you’re explicitly asking Relevanssi to not to return the best results first. Remove orderby and order parameters from the query, and you’ll get the most relevant results first.

    Also, this is better:

    $args = array(
                    ‘orderby’ => ‘menu_order’,
                    ‘order’ => ‘ASC’,
                    ‘post_type’ => ‘catalogue’,
                    ‘s’ => $search_query,
                    ‘relevanssi’ => true,
    );
    $query = new WP_Query( $args );
    Thread Starter jenkinsmi

    (@jenkinsmi)

    $thanks = true;
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search showing exact match low down in results’ is closed to new replies.