Continue reading WP Download Manager

WP Download Manager

WP Download Manager is a popular file management plugin for WordPress. It’s unfortunately incompatible with Relevanssi attachment content reading out of the box, as Relevanssi expects the attachments to be stored in the Media Library, and WP Download Manager stores the files outside Media Library. Fortunately, Relevanssi includes the necessary filter hooks that make it…

Read more WP Download Manager 0 Comment on WP Download Manager
Continue reading Exact matches for short search terms

Exact matches for short search terms

Is is possible to set Relevanssi in a way that it would return only perfect matches for queries up to 3 characters, but any words that starts with the queried term if it has 4 characters or more? – Originally asked here Yes, but it requires a bit of code. Add this to your site and…

Read more Exact matches for short search terms 0 Comment on Exact matches for short search terms
Continue reading Indexing only attributes from shortcodes

Indexing only attributes from shortcodes

I need to add some custom shortcodes to the list of the “removed” ones (so they don’t show in plain text in the results). However, some of them are built like [shortcode_name text=”Need to keep this in results”] and I would like the content in the text parameter to stay in the results. How do I go about this?…

Read more Indexing only attributes from shortcodes 0 Comment on Indexing only attributes from shortcodes
Continue reading Boosting shorter posts with higher keyword density

Boosting shorter posts with higher keyword density

By default, Relevanssi tends to prefer longer posts. The default TF × IDF weights Relevanssi uses simply count the term frequency, ie. how many times a word appears in the post. That prefers longer posts as they usually have the search term appear more often. However, a 500-word post with 15 search term appearances might…

Read more Boosting shorter posts with higher keyword density 0 Comment on Boosting shorter posts with higher keyword density
Continue reading WooCommerce: Return only exact matches for SKU searches

WooCommerce: Return only exact matches for SKU searches

This little filter function works on relevanssi_hits_filter. When a search query is made that matches an SKU (or any other custom field, but SKUs are the most likely scenario here), only results that match the SKU will be returned. For this to work, Relevanssi must be set to index the _sku custom field (because otherwise,…

Read more WooCommerce: Return only exact matches for SKU searches 1 Comment on WooCommerce: Return only exact matches for SKU searches
Continue reading Using phrases in Related posts searches

Using phrases in Related posts searches

I have a book review site where I’m using Relevanssi Premium and the Related posts to highlight related book reviews. The reviews have multiple taxonomies used for the related posts: tags, book author, series, characters, and places. Messy relations The problem is, with the default settings, the Related posts get a bit messy. This site…

Read more Using phrases in Related posts searches 0 Comment on Using phrases in Related posts searches
Continue reading Indexing product codes with and without spaces

Indexing product codes with and without spaces

A Relevanssi Premium customer had a problem with product codes. The codes are in the format “ABC 100”, a group of letters and digits with a space in between. Users may search for the codes without the space, so the post should be found with “ABC 100” or “ABC100”. The product codes don’t appear in…

Read more Indexing product codes with and without spaces 10 Comments on Indexing product codes with and without spaces
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 Excluding old content from the search

Excluding old content from the search

Is there a way to exclude anything before 2016 from search results? Yes. There are two approaches to this. If you never want to see anything old in the results, it’s best to filter in indexing with relevanssi_indexing_restriction. Add this to your site: Note that the restriction explains which posts are included in the index,…

Read more Excluding old content from the search 0 Comment on Excluding old content from the search
Continue reading Restrict search by author from the search query

Restrict search by author from the search query

You can set Relevanssi to index the post author, which will then let you find posts by searching for the name of the author. But what if you want a stricter filter? Where searching for an author would only show posts by that one author and nothing else? That’s possible too. Add this function to…

Read more Restrict search by author from the search query 0 Comment on Restrict search by author from the search query