Continue reading Support for ^ and $ anchoring operators

Support for ^ and $ anchoring operators

In regular expressions, ^ can be used to match beginning of the line and $ to match the end of the line. For example, ^ban will match banana, but not urban, while ban$ matches urban, but not banana. These are called anchoring operators. By default, Relevanssi matches either beginning or the end of the word,…

Read more Support for ^ and $ anchoring operators 0 Comment on Support for ^ and $ anchoring operators
Continue reading Adding direct links to outside pages to search results

Adding direct links to outside pages to search results

Hi, is there a way to add a link to another website when searching for certain keywords? We have a few affiliates and we want to include a direct link to their websites in the search results when certain terms are searched for. How would I go about this? A straight-forward approach for this is…

Read more Adding direct links to outside pages to search results 0 Comment on Adding direct links to outside pages to search results
Continue reading Relevanssi breaks autoembeds on result pages

Relevanssi breaks autoembeds on result pages

You may notice that enabling Relevanssi custom excerpts breaks all autoembeds (things like Youtube video embeds) on search results pages. That’s done on purpose, because the autodiscovery of those embeds can be a proper performance killer if the search results include lots of embedded content. Thus, Relevanssi switches the feature off, considering it’s not commonly…

Read more Relevanssi breaks autoembeds on result pages 0 Comment on Relevanssi breaks autoembeds on result pages
Continue reading Moving the admin search page

Moving the admin search page

Jules Colle came up with a method of moving the Relevanssi admin search page from under the Dashboard heading to the top level of the admin menu. This function adds an admin_menu action that first uses remove_submenu_page() to remove the existing admin search function and then add_menu_page() to add it again on the top menu…

Read more Moving the admin search page 0 Comment on Moving the admin search page
Continue reading Forced phrase search with fallback

Forced phrase search with fallback

Relevanssi by default does not consider the search query a phrase, or value posts where the words in the search query appear together. Sometimes people do expect that, especially in AND searches. Relevanssi however does not have the information about the nearby words, so it’s not possible for Relevanssi to factor that in. Relevanssi does…

Read more Forced phrase search with fallback 0 Comment on Forced phrase search with fallback
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 coding. With the latest version (free…

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 a SKU (or any other custom field, but SKUs are the most likely scenario here), only results that match the SKU will be returned. In order for this to work, Relevanssi must be set to index the _sku custom field…

Read more WooCommerce: Return only exact matches for SKU searches 1 Comment on WooCommerce: Return only exact matches for SKU searches