• Resolved clinto69

    (@clinto69)


    Two questions

    1. What are default relevance numbers for Title, Content, SKU, Short Description, Category and Tag out of the box?

    2. I was provided this code to add more relevance to words in Product Title but its not working. When i add this code no products are found at all. Is this incorrect?

    add_filter( ‘aws_search_query_array’, ‘my_aws_search_query_array’ );
    function my_aws_search_query_array( $query ) {
    $relevance = “( case when ( title = ‘meta_artist_name’ ) then 500 else 0 end ) +”;
    $query[‘relevance’] = preg_replace( ‘/\(SUM\([\s\S]*?\([\s\S]*?case[\s\S]*?end[\s\S]*?\)[\s\S]*?\+/i’, ‘$0’ . $relevance, $query[‘relevance’] );
    return $query;
    }

Viewing 1 replies (of 1 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    1. Title – 500
    Content, Short Description, Category, Tag – 100
    SKU – 300

    2. Sorry about that. Please try this code snippet instead:

    add_filter( 'aws_search_query_array', 'my_aws_search_query_array' );
    function my_aws_search_query_array( $query ) {
        $relevance = "( case when ( term_source = 'title' ) then 500 else 0 end ) +";
        $query['relevance'] = preg_replace( '/\(SUM\([\s\S]*?\([\s\S]*?case[\s\S]*?end[\s\S]*?\)[\s\S]*?\+/i', '$0' . $relevance, $query['relevance'] );
        return $query;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Relevance Weighting’ is closed to new replies.