Continue reading Search form: Search only in titles

Search form: Search only in titles

If you want to add an option to search only in titles to your search form, here’s how. First, you need to modify the search form to add the selection. To add a simple dropdown, add this to your search form: This select element will create a small dropdown with the option to search everything…

Read more Search form: Search only in titles 0 Comment on Search form: Search only in titles
Continue reading Boosting shorter posts with higher keyword density

Boosting shorter posts with higher keyword density

…$idf ) { global $relevanssi_post_idl; if ( isset( $relevanssi_post_idl[ $match->doc ] ) ) { $idl = $relevanssi_post_idl[ $match->doc ]; } else { $current_post_object = relevanssi_get_post( $match->doc ); $minimum_doc_length = 5000; // in characters if ( ! $current_post_object ) { $idl = 1; } else { $post_content = $current_post_object->post_content; $pdf_content =……get_post_meta( $current_post_object->ID, ‘_relevanssi_pdf_content’, true ); $content = $post_content . ‘ ‘ . $pdf_content; $post_length = max( $minimum_doc_length, strlen( $content ) ); $idl = $minimum_doc_length / $post_length; } $relevanssi_post_idl[ $match->doc ] = $idl; } $match_multiplier = $match->weight / ( $match->tf * $idf ); $match->weight = $match_multiplier * $match->tf * $idf *…

Read more Boosting shorter posts with higher keyword density 0 Comment on Boosting shorter posts with higher keyword density
Continue reading Partial matches to just one custom field

Partial matches to just one custom field

Is it possible to set (with filters and/or actions/functions) Relevanssi to use whole words keyword matching for post titles and 2 custom fields, and partial keyword matching only for a specific custom field (sku in this case)? Indeed it is! That is, you can’t set different keyword matching methods to different parts of the post,…

Read more Partial matches to just one custom field 0 Comment on Partial matches to just one custom field
Continue reading Indexing private custom fields for admins only

Indexing private custom fields for admins only

I use private custom fields. I want to index them in the administration but not on the public site. How to do ? Initially this seems impossible to do with Relevanssi, but it’s possible. Doing this requires Relevanssi Premium. The free version doesn’t know which custom field matches the search term, it just knows some custom…

Read more Indexing private custom fields for admins only 0 Comment on Indexing private custom fields for admins only
Continue reading Free 3.5.5

Free 3.5.5

Relevanssi 3.5.5 is out now and available from the plugin repository. 500 errors caused by arrays in custom fields should be gone now. Improvements to the ACF “select” field support. Relevanssi will not break when frontend plugins insert posts. relevanssi_match filter has a new parameter, which contains the search term. Polylang support has been improved.…

Read more Free 3.5.5 0 Comment on Free 3.5.5
Continue reading Premium 1.14.5

Premium 1.14.5

Relevanssi Premium 1.14.5 is a recommended release, as it fixes significant bugs that caused failures when custom fields contained arrays and when front-end plugins created posts. Multisite users are happy to find out meta_query support has been added to multisite searches and the post type filters work better. Relevanssi had problems with plus signs in…

Read more Premium 1.14.5 1 Comment on Premium 1.14.5
Continue reading Adding extra weight to AND results in an OR search

Adding extra weight to AND results in an OR search

My Relevanssi engine has the AND operator enabled, with a fallback to OR when the search finds no matches. I’d like the search to display first the AND results and later the OR results. For example, if I search for “wedding party”, I’d like the search to show first the entries matching both words and…

Read more Adding extra weight to AND results in an OR search 0 Comment on Adding extra weight to AND results in an OR search
Continue reading Free 3.0

Free 3.0

…$wp_query before it is passed to Relevanssi. New filter: relevanssi_search_ok lets you adjust when search is enabled. New filter: relevanssi_pre_excerpt_content lets you adjust post content before excerpt creation. New filter: relevanssi_excerpt_content lets you adjust post content before excerpt creation, but after the_content. New filter: relevanssi_ellipsis lets you change the default……‘…’ in excerpts to something else. New filter: relevanssi_do_not_index is given a post ID and expects a boolean in return: should this post be indexed or not? New filter: relevanssi_match lets you meddle with the matching engine. New filter: relevanssi_results filters the result set from the search. New filter: relevanssi_content_to_index……need Relevanssi Premium, which does it better anyway. Relevanssi can handle certain whitespace characters better in indexing. Apostrophes are now replaced with whitespace instead of being removed. Relevanssi now shows correct number of results when posts_per_page is set to -1. Fuzzy search didn’t always activate when it should, if all…

Read more Free 3.0 32 Comments on Free 3.0
Continue reading Premium 1.7.4

Premium 1.7.4

…log which have at least one matching token with the search query. For example, a search for ‘john’ will match previous searches for ‘john blackbourn’ and ‘john smith’ as they both match ‘john’. A search for ‘john blackbourn’ will match a previous search for ‘john smith’ as at least one……order to use the related searches, you must have search logging enabled and a good log of past searches. Then add the following code to your search results template in a suitable place: function_exists( ‘relevanssi_related’ ) && relevanssi_related( get_search_query(), ‘<h3>Related Searches:</h3><ul><li>’, ‘</li><li>’, ‘</li></ul>’, 5 ); The first parameter is the……you can include a ‘related searches’ list similar to Google’s related searches at the bottom of results. Functionally it works great, but in practice none of the sites I use it on have a high enough volume of searches to return useful suggestions. The function returns queries from the search

Read more Premium 1.7.4 0 Comment on Premium 1.7.4