Support » Plugin: Relevanssi - A Better Search » Weights proplem

  • Resolved moh962008

    (@moh962008)


    Hello

    this is my element weight
    Element Weight
    Content 0.5
    Titles 10
    Comment text 0.5
    Tag weight 5
    Category weight 5`

    and its set be OR operator with partial words matching

    my problem is that the weight not working so for example if i have 20 products
    the first 10 product with TAG ( cpu )
    and the second 10 product with description ( cpu )
    when i search for cpu then i will get random results from the 20 products without Pay attention to weight << but depending on my understand of weight

    the products with the same tag should appear at the first then the others

    how i can solve this problem

    you can enter my site and try to search for CPU
    thanks

    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)

    When fixing weights, it’s best to use the Relevanssi admin search (Dashboard > Admin search). That will show you the exact weights Relevanssi has calculated for the posts. That will show you whether the results are sorted by weight or not.

    The results for “cpu” on your site seem pretty decent for me, but I don’t know what the expected result is.

    In any case, your weight multipliers are fairly low. If you want tag matches ranked higher, increase their weight more. Also note that “cpu” on your site is not a post_tag but a product_tag tag, so adjusting the “Tag weight” in Relevanssi settings doesn’t do anything, because it only applies to post_tag tags, not for any other taxonomies.

    This is a limitation in the free version of Relevanssi. Relevanssi Premium has a setting for “Posts tagged with taxonomy ‘product_tag'”, which is what you’d need here. Adding weight for custom taxonomies is more complicated in the free version of Relevanssi and requires code. This might help a bit:

    add_filter( 'relevanssi_match', 'rlv_product_tag_boost' );
    function rlv_product_tag_boost( $match ) {
    	if ( $match->taxonomy > 0 ) {
    		$match->weight = $match->weight * 5 * $match->taxonomy;
    	}
    	return $match;
    }
    Thread Starter moh962008

    (@moh962008)

    what is this code supposed to do ?

    increase the weight of product tags ?? thats it
    and what is the amount of increasing ?

    what is the features in the premium version ? i can put a weight for any taxonomy ?

    Plugin Author Mikko Saari

    (@msaari)

    With this code, Relevanssi checks each match it finds (ie. when a search term matches a document). If the match is made in any taxonomy, the weight of the match is increased. This will lead to boosting the product_tag matches. It also boosts other custom taxonomies, which may or may not be a problem.

    In Premium, you’ll have a setting on the settings page where you can directly adjust the weight of the product_tag taxonomy like you can adjust the regular tags in the free version.

    Thread Starter moh962008

    (@moh962008)

    really appreciate that

    thank you !!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.