Continue reading Premium 2.29 / Free 4.26

Premium 2.29 / Free 4.26

2.29.1 / 4.26.1 This release includes a couple of small improvements. The post part targeting with phrases is significantly better now, and the exact match bonus works much better. 2.29.0 / 4.26.0 This release includes a security fix to stop a SQL injection vulnerability. With this vulnerability users with at least Contributor role on your…

Read more Premium 2.29 / Free 4.26 0 Comment on Premium 2.29 / Free 4.26
Continue reading Integrating Post Views Counter stats

Integrating Post Views Counter stats

…in the weight calculations is straightforward. The best tool to use is the relevanssi_results filter hook. It lets us modify the weights of the posts. For each post, we calculate a weight multiplier based on the visitor stats and then multiple the weight of the post with that. I add……= 1; } $relevanssi_pvc_weights[ $post_id ] = $weight; } } return $relevanssi_pvc_weights[ $post_id ] ?? 1; } add_filter( ‘relevanssi_results’, ‘rlv_pvc_weights’ ); function rlv_pvc_weights( $post_weights ) { foreach ( $post_weights as $post_id => $weight ) { $post_weights[ $post_id ] = rlv_pvc_weight( intval( $post_id ) ) * $weight; } return $post_weights; }……$relevanssi_pvc_weights[ $post_stats->id ] = $post_stats->count; } $max_visits = max( $relevanssi_pvc_weights ); $factor = $max_visits / 1000; // This controls the normalization. foreach ( $relevanssi_pvc_weights as $post_id => $visits ) { $weight = $visits / $factor; if ( $weight < 1 ) { $weight = 1; } $relevanssi_pvc_weights[ $post_id ] =…

Read more Integrating Post Views Counter stats 0 Comment on Integrating Post Views Counter stats
Continue reading Integrating Koko Analytics stats

Integrating Koko Analytics stats

…the weight calculations is straightforward. The best tool to use is the relevanssi_results filter hook. It lets us modify the weights of the posts. For each post, we calculate a weight multiplier based on the visitor stats and then multiple the weight of the post with that. I add some……= 1; } $relevanssi_koko_weights[ $post_id ] = $weight; } } return $relevanssi_koko_weights[ $post_id ] ?? 1; } add_filter( ‘relevanssi_results’, ‘rlv_koko_weights’ ); function rlv_koko_weights( $post_weights ) { foreach ( $post_weights as $post_id => $weight ) { $post_weights[ $post_id ] = rlv_koko_weight( intval( $post_id ) ) * $weight; } return $post_weights; }……$relevanssi_koko_weights[ $post_stats->id ] = $post_stats->visits; } $max_visits = max( $relevanssi_koko_weights ); $factor = $max_visits / 1000; // This controls the normalization. foreach ( $relevanssi_koko_weights as $post_id => $visits ) { $weight = $visits / $factor; if ( $weight < 1 ) { $weight = 1; } $relevanssi_koko_weights[ $post_id ] =…

Read more Integrating Koko Analytics stats 0 Comment on Integrating Koko Analytics stats
Continue reading Premium 2.6 / Free 4.5

Premium 2.6 / Free 4.5

…automatic update. The download page shows two different versions of the plugin available. The basic version no longer includes tests or anything else you won’t need when actually using the plugin. The developer version includes tests and all sorts of other tooling you may find interesting if you’re a developer….

Read more Premium 2.6 / Free 4.5 5 Comments on Premium 2.6 / Free 4.5
Continue reading Debugging Relevanssi searching issues

Debugging Relevanssi searching issues

Relevanssi has plenty of useful filter hooks you can use to debug problems. Here are some examples of how you can use the Relevanssi filter hooks to debug issues. Add the functions one at a time to your site and run a search to see results. First, try the Relevanssi admin search. Before checking the…

Read more Debugging Relevanssi searching issues 11 Comments on Debugging Relevanssi searching issues
Continue reading Adding extra boost for exact title matches

Adding extra boost for exact title matches

Every now and then, somebody wants to see exact title matches higher in the results. Usually, the best way to do this is to increase the title weight, maybe switch the default operator to AND and let the Relevanssi algorithm lift the best results. If that is not enough, you can use this code to…

Read more Adding extra boost for exact title matches 13 Comments on Adding extra boost for exact title matches
Continue reading Free 2.9.13, Premium 1.7.6

Free 2.9.13, Premium 1.7.6

Small maintenance updates to both free and Premium, mostly with the same changes. Here’s what’s new in both: Fixed a mistake in the FAQ: correct post date parameter is ‘post_date’, not ‘date’. New filter relevanssi_results added. This filter will process an array with (post->ID => document weight) pairs. Private and draft posts were deleted from…

Read more Free 2.9.13, Premium 1.7.6 0 Comment on Free 2.9.13, Premium 1.7.6
Continue reading Custom weighing with relevanssi_match and relevanssi_results

Custom weighing with relevanssi_match and relevanssi_results

…taxonomy terms Weight from tags Weight from excerpts Weighing multisite subsites More weight for whole word matches Return only comments Weight based on parent Weight for featured images Boost matches from title beginning Performance issues Date-based weight Here’s an example function that will double the weight of posts published within……one week and halve the weight of posts older than that. add_filter( ‘relevanssi_match’, ‘date_weights’ ); function date_weights( $match ) { $post_date = get_the_time( ‘U’, $match->doc ); if ( time() – $post_date < WEEK_IN_SECONDS ) { $match->weight = $match->weight * 2; } else { $match->weight = $match->weight / 2; } return……some tips for improving the performance at the end of the page. How to use these functions? If you don’t know how to use these functions, please read Adding custom functions to your site. Table of contents Date-based weight Custom field -based weight Adding extra weight to users Weight from…

Read more Custom weighing with relevanssi_match and relevanssi_results 64 Comments on Custom weighing with relevanssi_match and relevanssi_results