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 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 theme functions.php: Note that the restriction explains which posts are included in the…

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
Continue reading Natural-language date queries

Natural-language date queries

I just wanted to be able to type in a date on the search and for the search to come up with all the blog posts for that date. This is one of those tasks that sounds really simple, but is actually complicated. However, this question piqued my interest and turns out it isn’t that…

Read more Natural-language date queries 3 Comments on Natural-language date queries
Continue reading Searching Bible verses

Searching Bible verses

A surprisingly common problem with Relevanssi is Bible verses. All that meaningful punctuation and single digits make exact matching of Bible verses really difficult for Relevanssi, and when searching for Bible verses, exact results are what matters – hitting something similar is generally not very helpful. There’s an easy solution, though: use phrases. Wrapping the verse…

Read more Searching Bible verses 1 Comment on Searching Bible verses
Continue reading Searching between dates

Searching between dates

If you want to have a search with a date range, that’s possible with Relevanssi. It takes a bit of handling, though, as Relevanssi expects date ranges in the date query format, and getting to that from search form can be tricky. Here’s the code you need for date range searches: add_filter( ‘relevanssi_modify_wp_query’, ‘rlv_date_between’ );…

Read more Searching between dates 8 Comments on Searching between dates
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. Place the functions one at the time in the theme functions.php file and run a search to see results. First try Relevanssi admin search Before checking…

Read more Debugging Relevanssi searching issues 7 Comments on Debugging Relevanssi searching issues
Continue reading Yoast Local SEO

Yoast Local SEO

Yoast Local SEO plugin breaks Relevanssi search. It enhances the search by adding meta queries. Unfortunately they don’t work with Relevanssi. The fix is simple, though. Add this to the theme functions.php: add_filter( ‘relevanssi_modify_wp_query’, ‘rlv_meta_fix’, 99 ); function rlv_meta_fix( $q ) { $q->set( ‘meta_query’, array() ); return $q; }add_filter( ‘relevanssi_modify_wp_query’, ‘rlv_meta_fix’, 99 ); function rlv_meta_fix(…

Read more Yoast Local SEO 14 Comments on Yoast Local SEO