• Resolved epokk

    (@epokk)


    I use relevanssi in free version and I am very happy with this plugin. Besides I think soon to switch to the premium version.

    For the weight of the search, it works very well for titles and content, but it does not work for categories. Today my weights are:

    Content: 1
    Titles: 150
    Text and comments: 0.75
    Tags: 1
    Categories: 300

    When I change the weight of the titles I notice a change in the search results but not for the categories.

    Thank you for your reply !

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

    (@msaari)

    Have you tried the Relevanssi admin search (Dashboard > Admin search)? It will show you the exact post weights, so you can see if modifying the category weight has any effect on the post weight.

    Have you set Relevanssi to index the post categories?

    Thread Starter epokk

    (@epokk)

    Thank you Mikko, it works perfectly! I forgot to index the categories …
    ?
    I have a second question about finding categories. I have many categories on my site, but there are much important categories than other categories.

    Is it possible that the weight of certain categories is, for example “300”, and that the weight of other categories is 1 ?

    Plugin Author Mikko Saari

    (@msaari)

    There’s no simple way to adjust individual category weights. But you can do this:

    add_filter( 'relevanssi_match', 'rlv_boost_categories' );
    function rlv_boost_categories( $match ) {
    	$boosted_categories = array( 'category_name', 'another_category' );
    	if ( has_category( $boosted_categories, $match->doc ) ) {
    		$match->weight = $match->weight * 300;
    	}
    	return $match;
    }

    Add this to your theme functions.php and put the names of the categories in the $boosted_categories array, and those categories will now have a weight of 300.

    Thread Starter epokk

    (@epokk)

    Thanks Mikko for your reply.

    I hadn’t seen that I hadn’t answered.

    Sorry to answer 5 months later! ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Weight of categories’ is closed to new replies.