User manual

Learn how to use Relevanssi. This manual covers both the free version and Premium.

Table of contents

151 comments User manual

  1. Hello,

    I would very much like to use your plugin but for some reason it will not find pages titled “FAQ”. I have quite a few pages with FAQ in the title and I can’t figure out how to get those pages to appear in the search. These pages do use a shortcode and I clicked the box to inflate the shortcode but still nothing. Any help would be much appreciated.



      1. Where do you get the default search box HTML code? Existing search box from WordPress doesn’t seem to do anything differently (after Relevanssi install and indexed). Can’t find anything about the html code in the user manual, which seems like a critical step to document and explain.

        1. Well, every WordPress installation I’ve seen so far has a default widget called “Search”, which produces a default search form that works perfectly with Relevanssi.

          1. This was a bit hard from me to understand as well. So your plugin enhances the default Search widget? I was looking all over the setting for a place that would say how to show your specific search box. Just a suggestion…make this a bit more obvious. “Relevanssii enhances the default WP search widget. All you need to do is install our plugin and you then use the Search widget that comes with WP.” Something like that.

            Thanks for such a nice plugin, though!

          2. How do you get the search to appear in the nav bar? I tried the widget function under my Nav widget with custom query wideget and it appears underneath the section and I want it next to my menu options. I suspect the this has to do with the hierarchy of the widgets. Is there another way to solve this problem?

  2. Is there a reason you don’t use search on this site? Seems strange to sell a Search product, then not use it yourself.

    1. does use Relevanssi for search, but looks like when I updated the theme, the search form disappeared somewhere. Since I don’t need it myself, I haven’t noticed before. Thanks for the notice, the search is now available (and of course uses Relevanssi Premium).

      1. Is there any way you could possibly provide a working example of a search results page which works with this plugin? To have a site which uses get_posts() or new WP_Query() but doesn’t work with this plugin is fine… if you could provide what DOES work in its place. Big thanks.

        1. All WP default themes work just fine with Relevanssi. See what they are doing.

          There’s no general solution to this, the correct answer depends on the site. If you can post your search results template in a pastebin somewhere, I can give some hints on how to fix it.

          1. Most impressed by your fast response. About 10 seconds ago, I went into the WP 2012 theme and pulled search.php to see what it’s doing. It actually produced results(!) but I am not sure how Relevanssi is involved yet or how to make it work for us with the “fuzzy logic” we need. It’s still too early but I will definitely look closer at it and play with it and read more about it. I am just happy to get some results! I will try not to bother you unless I really need help! Thank you for your effort!

          2. The thing is, Relevanssi replaces the first posts loop on the search results page. The problems begin, if the template doesn’t use the original posts loop provided by WP, but instead makes another query (with get_posts() or new WP_Query()) – Relevanssi doesn’t get involved in that second loop.

          3. I see. (and again big thanks for your reply! this is very urgent for me)

            I have my search results page now giving suggestions. This is great! However…. What I need to do is display them BY POST TYPE. We want to keep our search results exactly as they are using query_posts()…. but want to use Relevanssi to GUESS “what did you mean?” and offer alternate suggestions if they spelled something wrong. (for example)

            Is there any way to keep our existing search results and use relevanssi to offer a additional suggestions?

          4. As I don’t have a clue how your search results are right now, I can’t tell you how to do that with Relevanssi. Filtering results by post type is simple, and having “Did you mean” suggestions is a matter of adding the one function call – but what else do you need? I don’t understand that.

          5. Of course. I will explain in a reply to your email. Very grateful for your attention on the matter. Thank you.

          6. Hi Mikko. Is there anything you can do to suggest how it’s possible to get the Google -style “did you mean?” alternative suggestion? Your plugin page says the plugin can do this, but I cannot generate this no matter what I try. Do you have an example search results page which will output some proper results. I get a loop of 10 results (at most) but no suggestions if I spell something wrong. Please assist. I would be most grateful.

          7. Tom, Premium does what you want. The free version has the feature as well, but it’s based on earlier user searches and won’t work until there are enough logs gathered. Premium has a better version, directly based on your database.

            For installing instructions, see “Did you mean” suggestions.

          8. Hey! Thanks for your reply. OK purchased premium and looks to be cool. Replying to your email.

          9. Ideally I want someone to search for (example) “Ferrr”… and be able to say “did you mean FERRARI?. That’s the goal.

  3. is possible to find every Author’s post ?
    does exist a function to receive only the number of result found by the search ?

    Thanks !

  4. Hi Mikko,
    I want Relevanssi to search pages, but I want to exclude some. E.g. page such as privacy policy, terms of sales etc. – Is it not possible to exclude such pages in some way?
    I have tried several solutions, but nothing do the trick.
    Thank you in advance!

    1. Hah! Got it 🙂

      “Exclude these posts/pages from search:

      Enter a comma-separated list of post/page IDs that are excluded from search results. This only works here, you can’t use the input field option (WordPress doesn’t pass custom parameters there). ”

      Thank you! 🙂

  5. Is there any issues with relevanssi_do_query()? I am able to use relevanssi in the global search, but when i use relevanssi_do_query() for an AJAX call it, returns ‘Internal Server Error’

      1. No, I haven’t found a solution yet. Sorry for the delay, we had to temporarily deactivate Relevanssi to meet the dead lines. I will need to reinvestigate the issue. However, I will have to do a couple updates first, maybe it will be enough. From what I remembered, the error was not really explicit, the only thing i could see in the console was ‘Internal Server Error’, but again, I will come back with more information tomorrow. Thanks for you support!

  6. Hello and kudos on your work. I am not sure if this has been covered but I did try to find an answer with no results.

    I am using a custom theme that has its own search system, and it seems to be different than the default WP search since the coding is different. The form id is set to a different class and the input class is different as well.

    Question is: does your plugin improve any currently used search or only with the default WP search?

    1. The form ID doesn’t matter – the only thing that matters is the “action” in the form tag and that the search term input field is called “s”. If those match the default search, Relevanssi doesn’t mind anything else.

  7. How would I go about adding the function for automatically filling in the search as the user types, such as the user has typed “Brent C” and then automatically “Brent Cross Shopping Centre” is filled in similar to the way Google search does it? Only I would create a catalogue of these guesses. Can you advise? Is this in the free or premium version?

    1. Yes. Relevanssi won’t search inside the PDF files, though, but it’s easy to limit the attachment search to just one media type. I’ve done that before: it’s couple of lines of code.

  8. Can I restrict results to just one taxonomy when users search from the knowledge base, and another when searching from the blog?

      1. Thanks! Right now, I’ve set it to only index the articles in the knowledge base. Should I index both the blog articles and the knowledge base articles so that the taxonomy will work in the blog, or will the taxonomy override this?

          1. I’m a novice and have no idea where or how to make these changes (I’ll try hard to figure it out though). If I buy the premium version, would this type of help be included in the “guaranteed support”?

  9. Can someone point me to a tutorial on how to set up Relavanssi to avoid the following issue?
    I need to search for products that have “over lapping tags”. What I mean is that my visitors search for “Clemson Tigers” but the search also returns “Savannah State Tigers”. How do I set it up to not return the other tags that share one of the search terms? I have already set the operator to “And”.

    Will I need the Premium version? That’s OK, I’ll buy it,. I just really need a tutorial for dummies so I can make it work properly.

    The website is I didnt make the site but it’s my job to fix it. I’m new to wordpress so I really don’t know what I’m doing in this environment.


      1. Hello Mikko, Thanks for the quick reply.

        No that didnt work. Here is another example.

        There are two shirts tagged with “Florida State Seminoles”, a red shirt and a white shirt.

        When I search for “Florida State”. I get one shirt that is tagged with “Florida Gators” and “Savannah State Tigers”, and another shirt that is tagged with “Florida State Seminoles”.
        Somehow I do not get both of the shirts tagged with “Florida State Seminoles”. If I search for “Florida State Seminoles”, I get only the white shirt.
        Searching for “Seminoles” gets both shirts.

        Maybe my description isnt clear. This is the search page if you want to see for yourself:

        Can you think of some mistake in the site that could cause this issue? Can you think of a way to work around it?

        Thank you very much!


        1. Hi, sorry, can’t really tell anything more just by looking at the site. I’d need to see under the hood to tell what’s going on.

          I would at least try rebuilding the index, tag indexing can have some issues if the tags are edited after the post is indexed.

          1. Some of the tags have been changed. I’ll try rebuilding the index, as you suggested. Thank you!

      2. Actually the Clemson Tigers example seems to work now but the Florida State Seminoles example still is not working

          1. 1) Have you made sure the search is powered by Relevanssi in the first place?

            2) Have you installed the “Did you mean” feature? It does not appear automatically, you need to install it yourself. The fuzzy search feature has nothing to do with that.

  10. Having a problem with my search and wondering if there is a fix that you could help with. We have several page titles that have “s” at the end of the word like “credit cards”. However, most people will search for “credit card” and because of the frequency of the words credit and card on the site, those results come up before the actual page with that title. Any advice on how to adjust it because adjusting weights has not seemed to help?

    1. No easy solutions here, unfortunately; if those are common words on your site, getting the right pages to rank high can be hard. Easiest solution would probably be buying Relevanssi Premium so you can use the pinning tool: there you can choose the posts you want on top of the results and pin them for those search terms. Then whenever someone searches for “credit” or “card”, the pinned posts will appear highest on the list.

      Premium also includes a simple stemmer, which can normalize every occasion of “card” or “cards” to be the same, which may also help. But I think pinning will be the easiest and the cleanest solution here.

      1. Thank you for the prompt response. I’ll probably trying adjusting stuff a bit more, but the pinning seems like the solution. Thanks again

        1. To enable the English stemmer (which isn’t really a stemmer, just a simple suffix stripper), add this to your theme functions.php:

          add_filter('relevanssi_stemmer', 'relevanssi_simple_english_stemmer');

          Then rebuild the index. The words are now processed with the stemmer, both when indexing and when using them in the search. Once you do that, for example “read”, “reader”, “reads” and “reading” will all be considered the same word when searching.

  11. Mikko – We (I work with Kevin Kelly) recently purchased Relevanssi Premium (for the pinning content functionality) and it works beautifully, however, we’re also using Visual Composer on a most pages.

    After some research, I was directed to this post:

    which helped me get rid of the VC wrapper elements in search excerpts just fine, however, it caused another issue.

    Some of our pages have iframe content, which is not being stripped out correctly.

    I’ve tried to debug as best as I can:

    – When I disable the Relevanssi Premium plugin, the search excerpts render fine. With no VC content wrappers, nor with a rendered iframe.

    – When I enable the plugin (without the filter), the search excerpts display the VC content wrappers, and render the full iframe contents in the results.

    – When i enable the plugin WITH the “relevanssi_pre_excerpt_content” filter, they are rendered with no VC content wrappers (as expected), but iframe contents are rendered as gibberish, as shown in the screenshot.

    Any information you could provide would be helpful – or let me know if you need more information. Thank you.

    1. Hi, first of all – you have a Premium license, which gives you access to Premium support. Do use that, it gets you answers faster.

      You’re close to the solution, actually: I think you can use the relevanssi_pre_excerpt_content to remove the iframes from the content before excerpt-building. That should get you cleaner excerpts.

      You can var_dump() the content in the filter to see what’s there at that moment, to help you figure out what exactly you need to clean out.

      1. Mikko:

        Thanks for the response. I actually did get it figured out. I used the same pre_excerpt_content function and just had to find the right RegEx to strip the iframes and content. (I’m not overly familiar with RegEx, so that took a little bit of time).

        $content = preg_replace(‘(<iframes+.*?n)(.*.)(n.*)’, ”, $content);

        But all is well and working fine. Thank you.

  12. Mikko, is there a way to use your search on a specific page that restricts the eligible results to just one category? I want to create a list of terms for a glossary that all have the same category assignment, and then to allow users to search only that category.

    1. Sure, just add a hidden input field with the name set to “category” and value set to the category ID in the search form on that page. That’ll restrict the search to that one category.

  13. Hi
    I am using Relevanssi for admin area search for custom posts. But I just noticed that you can search only the already indexed post and if you create a new post, you can get it in search result until you re-index the posts. is it right? I am using the free version.

  14. Is there a way to display a different page when there are no results found for a given search? For instance, when someone searches on our site, we have a phrase and an image that basically says, “we found what you’re looking for”. What we’d like to do is have a different phrase and image come up when there were no matching results.

    Additionally, it would be great to include the search box in the content area of that page so they can easily do a different search.

    Any assistance would be greatly appreciated!!

    1. Laura, this is just a question of modifying the search results template from your theme. That’s what is responsible for all that. You can modify the “no content found” part of the template as much as you wish, and adding a search form isn’t difficult either. The exact details depend on which theme you are using and how that is built.

  15. Hi, I downloaded the free version to test it but it doesn’t seem to make a difference at all. Is there a period of time I have to wait? I re-indexed to make sure it picked up the rules.

    The basic thing is, we’re a school and we want the “Title IX” page to show up if someone does an internal search for rape or sexual assault (it does not come up at all, there’s a lot of random and irrelevant pages).

    I opted for synonyms, as well as “and” searches, but everything seems exactly the same as before the plug in?

    I don’t think we even have 500 total pages – is that the issue?

    1. Mari, Relevanssi will start to work immediately after you activate the plugin and build the index, if your theme is compatible. Your site is using Google Custom Search, the search results are not powered by Relevanssi. You need to first disable Google Custom Search first, so you get the WordPress default search results.

  16. Results page problems. I love the great reviews & decided to replace Better Search with Relevanssi. I think I did wrong something wrong, because my results page does not give results, but does have this shortcode: [siq_ajax_search] ,

    My guess is I need a different shortcode, or is it something else?

    btw, I am using Generate Press premium theme.

    1. Gloria, you’ve been using some kind of AJAX search results. It’s either from your theme or some third plugin, because that shortcode is not from Better Search, either.

      Relevanssi doesn’t need any shortcodes on the search results page, but instead needs a regular search results template. GeneratePress should include one, as far as I can tell, since it’s a very basic WordPress feature.

  17. I like Relevanssi a lot. One thing I’m having a little trouble with is indexing media uploads. I see that posts get indexed immediately. If I upload a media item and apply a tag or category it does not get indexed until I manually rebuild the index. Is there a way to change this behavior?

    1. Josh, if you have set Relevanssi to index the attachment post type, it should be indexed whenever it is added. Applying tags and categories doesn’t trigger reindexing for any post, but saving the post should cause reindexing for that post, no matter which post type.

  18. I am started using this plugin in my wordpress 5.1 website. It works well but it gives few issues. I have setup a new page and add following words in it :
    technology1 partner1 huawei ps4pro redident

    It display the page only if I search with : technology, partner
    If I search with other above words then it cannot show the page in search.

    Why this behaviour occurs? please guide

    1. Tariq, I have no idea and no way to tell. If all the words are in the post content the same way, Relevanssi should index and find them all. Check the wp_relevanssi database table: do all the words appear there for the post?

  19. Hi Mikko
    First of all I would like to thank you for your plugin. It’s really helpful.
    I just have a concern regarding the searching logic, I see that the logic considers the weight based on the tf value calculated which reflects the number of times the word is mentioned in a post. This approach could cause some confusion when a sentence containing a keyword present in most of the articles as the weight will give priority to the posts containing this specific keyword more than other posts containing the whole sentence but the keywords are not repeated. For my case, I preferred to adjust the weight through the words mentioned rarely by dividing the weight by the $matches->count and the tf value to focus on the posts containing more words of the searched sentence.

    I did workaround on that through this function:

    function adjust_match_weights($match, $idf, $term ) {
    global $wpdb;
    $term_count = $wpdb->get_var(“SELECT COUNT(term) from wp_ecrs_relevanssi WHERE term = ‘$term'”);
    $match->weight = $match->weight / ($term_count * $match->tf);
    return $match;
    add_filter(‘relevanssi_match’,’adjust_match_weights’, 10, 3);

    It’s working fine. However I needed to add a separate query for each term through the loop to get the $matches->count value as the hook relevanssi_match doesn’t included. I don’t think this is the best practice due to increasing the database queries when $matches->count was already accessed before. It can even be used if I updated the core but not through accessing the relevanssi_match filter. Could the $matches object be included in the apply_filters function in a next update?

    Also regarding the synonyms, I noticed that if I added a synonym key and value it’s stored in the options table. However, if I came afterwards and wrote another synonym key and value it will overwrite the previous value in the database. I think that a simple concatenation function can solve this issue in the interface.php file.

    Is there a concern changing this line:
    $value = str_replace( $linefeeds, ‘;’, $_REQUEST[‘relevanssi_synonyms’] );

    To be that way?
    $value = get_options(‘relevanssi_synonyms’). “;”. str_replace( $linefeeds, ‘;’, $_REQUEST[‘relevanssi_synonyms’] );

    I tried it and it worked, however there are no filters here which means that I need to update it in the core. If I did so, I will need to change it every time I update the plugin. Couldn’t this be incorporated in a next update?


    1. Mohamed, I’m not really catching the reasoning behind your weighting suggestion. The TF × IDF weighting has been an industry standard for 60 years and for a good reason; it generally works really well. If you want to make a post with a smaller weight for a particular keyword rank higher for that keyword, the easiest solution would be just to pin it using the pinning feature in Relevanssi Premium: that will guarantee first ranking in the search, without any additional code.

      Your filter function is indeed not good for the performance: running all those extra queries will hurt the performance a lot. Why not use IDF instead? It’s already passed as the parameter to the filter, and while it’s not exactly the same as the term count you’re calculating, I think it’s generally the more useful number. Looking at the IDF is more helpful than the raw TF across the whole database, because the raw TF has no upper bound, while IDF has (the number of documents).

      Passing the $matches array as a parameter to the filter doesn’t help, because there’s no $matches->count value in it – Relevanssi doesn’t calculate the raw TF.

      Your suggested fix for the synonym interface would break it badly. Your change would make it impossible to ever remove synonyms, and the same synonyms would be duplicated many times every time the synonyms are saved. There’s no need to fetch the option value, because $_REQUEST[‘relevanssi_synonyms’] already includes all the synonyms, both old and new. If it doesn’t on your site, then there’s something wrong with the way your site works. It’s working as it is.

  20. Great plugin! Is there a way to access the “Category restriction” data? I’d like to display it in my search form so the users know which documents can be searched. Ultimately, I’d like to allow the users to select (check/uncheck) which documents (i.e. categories) they want to search and then filter the results. Thanks for your help.

    1. Joe, if you want the users to make choices on category restrictions, don’t set it up from the settings. One way to do it is to add a category dropdown – you can see how it’s done by using the

      [searchform dropdown="category"]

      shortcode. Checkboxes are also an option. The category parameter is called cats and it wants a comma-separated list of category ID numbers.

  21. Hello,

    Is it possible to use this plugin and create a search form with results from an external API that gets the results in JSON data?

  22. Hi

    I have Relevanssi plugin version 4.6.0 (I also have facetwp product filters)

    The search is behaving very oddly.

    Under indexing

    1) I have the following post types checked : post, product, product variation

    2)Under Taxonomies I have the following checked : product_tag, pa_gemstone, pa_metal, pa_gold-carat (these are product attributes)

    3) comments – none

    4)custom fields some (_sku)

    5)Excerpts unticked

    Under Searching

    1) And -require all terms

    2)Fallback to OR – unticked

    3)Default Order – Relevance

    4)Keyword matching – Whole words

    5) Weight :
    Content 500
    Titles 500000
    Comment text 0.75
    Tag weight 100000
    Category weight 1

    6)Boost exact matches ticked

    7) Throttle searches unticked

    When I search on my website for “Citrine ring” I am shown 51 results (some of which are repeated) on other pages.

    I have been uploading new items and even after rebuilding the index and playing around with the tag weight and title weight some items are simply not shown in the results. However, when I click on the “Citrine” filter under the “Gemstone” heading or if I move the price filter slider slightly which results in the following URL

    I am then presented with the new items but it still says there are only 51 which means some items from the initial search must be missing

    How do I get all the relevant items to come up on the initial search ? The missing “Citrine Rings” have “Citrine” and “Ring” in titles and “citrine ring” in tags.

    Please let me know


    1. Louis, for starters, check the Relevanssi admin search (Dashboard > Admin search). Are you getting the same results there? In the same order? I have a feeling the results may not be in the order of relevance, though it’s hard to say, when the posts have so indistinct titles, it’s hard to say which post should be the best match. Relevanssi admin search will show you the exact weights Relevanssi has calculated for the posts.

      This search without the post type parameter finds over 80 results:
      With a product restriction, there’s still 53 results:

  23. Hi Mikko,

    Thanks for your reply

    When I do an admin search I get 58 results

    Query variables
    post_types: product
    s: citrine ring
    meta_key: total_sales
    relevanssi_admin_search: 1
    orderby: meta_value_num
    order: DESC
    operator: AND
    posts_per_page: -1

    10: relevanssi_acf_relationship_fields
    10: popularity_first
    10: relevanssi_limit_filter
    9: relevanssi_default_post_ok

    I’m beginning to think that the sort by box is interfering with the search results. Do you think this is a possibility ?

    I did change one of the products to just “Citrine Ring” but it is still missing in the initial search result.



  24. Thanks, the sort is set for total_sales which is the same as “popularity” The default search though is missing items but when you select “popularity” the items appear but this is supposed to be the same as the default sort but the results are different. I realise the sort box is a facetwp issue but if you have any suggestions how to get the sort results of the default to mirror one of the selections then it would be most appreciated.



  25. Hi, I would like to know if there is way of having a search bar look for products only and another search bar look for posts. I cannot find information on how to do this, only on how to exclude products from search results, or posts.
    I would greatly appreciate a solution for this. Thank you!

  26. Hi!
    I’m using your plugin for thr first time (with shortcode)
    I’m trying to get results i=only for the category Noticias, it’s working perfect.
    If there is no results, the page shows a message saying: Try again with another terms… and the next time, the results will include any category.

    So, when there are no results, the last hidden field is not there anymore.

    Any advice?

      1. Hi!
        wow, I never thought you could answer that fast!!!
        Could you please guide me on how to do it? Or when may I look for informatio about modifying the results page?
        I only want this behaviour on one of the pages, the rest of the website should show all the results, unfiltered.

        1. Carmen, this needs to be done in the search results template. The form needs to be modified so that it picks up the current category parameter, so if one is set, it’s used, but if there’s no category parameter, none is added. The exact details of how this is done depend on the way the search form is done on your site, so it’s hard to explain here. This is something every decent WP developer should be able to do, so perhaps you can hire someone to do this for you?

          1. I got it now, thanks.
            I haven’t done any php programming for years but tonight looks like a good time for it 🙂
            Thanks for the fast replying, the help and the amazing plugin,
            good night.

  27. Good morning,
    I installed relevanssi with the plugin “Search and Filter” and I would like the search to be done only in the custom field and not in the content of the post.
    I put the tick on custom fields and I tried to set the weights:
    But the custom field is not found, what can I do?

    1. Laura, instead of negative weights, set the weights to zero. If you don’t want content to be found, it’s best not to index it in the first place.

      As for the problem with custom fields, after you’ve fixed the weights, try searching with the Relevanssi Admin search (Dashboard > Admin search). Can you find the custom field there? If not, try the “Debugging” tab and see how the posts look like in there: is the custom field content indexed correctly?

        1. Laura, ah, right. You can’t set the weights to zero. But that’s another reason to properly exclude the content from the index, it will make indexing and searching faster, too, and save up a ton of database space.

          Relevanssi can’t find any of the custom field content, because none has been indexed. Have you set Relevanssi to index the correct custom fields, and have you rebuilt the index after adjusting the settings?

          1. Laura, the problem is the negative weights. If you don’t want post content or titles included, set the weights to 1 and remove the content and title from the index. That’s the correct way to do this. Setting the weights to negative values will stop custom field matches from appearing in the results. Exclude the post content and titles from the index and rebuild the index, then this should work as you expect.

  28. Hi! i just installed the plugin to help sort my sear results by relevance by default, and it absolutely helped with that! However, it has now restricted my search results to 12 – no further result pages, just one page with 12 results no matter how many results the search should be returning.
    eg: my website is searching “dice” should yield many more results, but it has now been restricted to 12.
    Is there any way to get around this?
    thank you!

    1. INES, that’s something that is controlled by your theme. Relevanssi just provides a bunch of results for your theme, and your theme controls how they are paged. Your search results template is likely missing the pagination features. If you have theme support available, they should be able to help.

  29. How exactly is the “relevanssi_prevent_default_request” filter supposed to be used? The current site I am working on uses this to determine if the current WP query should be killed or not. It kills the request if there is a value for the ‘s’ argument of the query, but once it kills the WP query the query never gets run.

    Is this how the filter is supposed to be used? The previous builders of this custom theme (no, support from them is not possible as they want to charge $100+/hr for support) built it that way and as a result unless the filter is bypassed basic search queries return no results though my understanding is it *used to* return results (perhaps a Relevanssi update messed with their custom code).

    Could somebody please explain to me (if your able, thank you!) how this filter is supposed to work?

    1. Anthony, that filter is used to control whether Relevanssi should block the default request or not. This is mostly useful when there’s some other plugin that has a search where you don’t want Relevanssi to interfere, and in that situation you use the relevanssi_prevent_default_request filter hook to make Relevanssi not block the default query. But I can’t tell what your developers have been thinking about here. If you can show me what you have in the filter, I can perhaps help more. Based on what you’re describing, it doesn’t sound like it’s doing anything particularly useful, but I don’t know any context.

      Relevanssi changed recently and switched from the_posts to posts_pre_query hook, which makes using this filter hook less important in any way.

      1. Mikko,
        Thanks for the information – sorry for taking so long to reply. This is the relevant code that uses the filter (I’m not sure how to format code for this forum or if it is possible but here it is):

        function rlv_fix_archive_kill( $kill, $query ) {
        if ( ! is_admin() ) :
        if ( empty( $query->query_vars[ ‘s’ ] ) ) :
        $kill = FALSE;

        return $kill;

        add_filter( ‘relevanssi_prevent_default_request’, ‘rlv_fix_archive_kill’, 10, 2 );

        I can only make searches work by changing the
        if ( empty( $query->query_vars[ ‘s’ ] ) )


        if ( !empty( $query->query_vars[ ‘s’ ] ) ).

        1. Anthony, this function is added so that Relevanssi does not block archive pages where the search terms are not defined. I’m pretty sure you can just disable this whole function, I don’t think it’s necessary at all.

          1. Mikko,

            Thanks for the explanation. I tested disabling it and, for some odd reason or other, the search functionality is broken again. I imagine something, somewhere, is expecting this function to run. Might you have any suggestions as to what may be expecting it to run? If not, everything seems to work with me modifying the logic of the second if statement as described previously.

  30. Anthony, I can’t really tell what’s going on, there are clearly some pieces missing here. If modifying the logic works, do that, but that should not be necessary. If it is, something’s wrong.

    1. Mikko, I agree – something is probably missing somewhere but unfortunately I’m not sure what exactly it would be (or what the previous developers were thinking). For the time being modifying the logic does work and I thank you for the help you have been able to provide me with this issue!

  31. Hi,
    First of all, thanks for this amazing plugin. However, it appears when you search a word and the word is inside HTML table cell, the search results doesn’t show the full table, it just shows it as a text.

    Is there a way to show the search results inside HTML table, if the search word appears to be inside table cell?

    1. Khalid, the way the search results are displayed depends on your theme. Relevanssi creates excerpts that don’t have the full table, so if you want the table displayed, you need to modify your search results template so that it shows the table. That’s somewhat complicated, and the exact way to do that depends a lot on your particular use case, I think this is something where the exact needs will vary a lot.

      1. Thank you.
        I will actually be using different theme for the actual site, I will try the compatibility with that theme first before proceeding further.

        Do you have idea if any theme works fine with displaying tables?

        Also, I am trying to use search result as a string. For example if I search “Range Coconut Milk (17% fat)” It shows separate results for each words. How can I customise it to show results matching the full string?
        Thank you

        1. Khalid, displaying the tables is such a custom need that you need to custom build it in any case, unless there’s a theme that’s specifically made for your case.

          Wrap the search terms in quotes to get a phrase match, ie. "range coconut milk (17% fat)". That will get you exact matches.

  32. Has anyone had an issue where your excerpt is including the Page Title of the search page?

    Home > You searched for science ( rest of excerpt)

    I can’t find a solution and it’s driving me nuts.

    1. Jess, which page builder are you using? Sounds like a page builder feature to me, like some breadcrumb element is creeping in to the excerpt. I’ve seen that before, but I don’t remember the solution how it was solved before.

  33. Hi, Oxygen builder just recommended you.
    I’m trying to find out if this plugin will allow me to have different searches? I want to keep them separated so that I can search a few glossaries on certain pages, plus separately search certain posts (different blogs), and others… For the user is should look to be completely different searches that works on the page(s) they are at. If you are reading one of three blogs it should only search that blog and not the others. Thanks!

    1. Steve, yes that is possible. As long as the different blogs are separated in a way that Relevanssi can understand (different post type, different category or something like that), it’s not hard to create search forms that search only a specific subset of posts.

  34. Hello. I have 32000 positions in woocommerce, when building an index, it takes about 18000 and then the plugin hangs. When trying to continue indexing, he makes them one at a time and eventually also hangs.
    The site is on VDS, can you have any recommendations for fine-tuning the server for optimal plugin operation?

    1. Nickolay, I don’t know anything about server fine-tuning, so no ideas there. Also, is this a server performance problem, or is there something in the posts that Relevanssi can’t digest? Is the post content just plain text, or are there perhaps post loops or other slow elements like that? Lots of possibilities there, so I can’t really tell offhand what’s up here.

  35. Hi, possibly a dumb question but how do we see what people are searching for on our sites that use Relevanssi? Is it possible to get a report or connect Relevanssi to GA4 so we can track search terms etc? Thanks 🙂

    1. James, go to Settings > Relevanssi > Logging and enable logging. Relevanssi will then keep logs of all user searches.

      You can also set up Google Analytics to track the searches. There are lots of instructions online, as the process has nothing to do with Relevanssi. Enable “Site search tracking” in Analytics; the “Query parameter” is s.

  36. Just installed Relevanssi on a large site, and it’s working great.

    However, at times I still want to access the old, dumb search results. Is there a way to do that?

    Such as a way to put a search form on just one page, and have that return the old version of search results. Or perhaps a parameter to add to the query URL, so that old results are returned.

  37. Thank you for the great work and support.

    Relevanssi is no longer working proper on my site. It is triggering “There has been a critical error on this website.” in respect of certain keywords, eg. “Appeal”, whereas other keywords – eg. “lien” return results without error.

    The problem started after I updated the Index yesterday.

    Thank you.

        1. Levi, that’s just a note there’s been an error, not the actual error message. The site admin may have received an email with the actual error message, or it can be found in the server error logs.

          Try disabling the custom excerpts in Relevanssi. Does that help? Since the problem only happens with specific search terms, that’s often a problem with the excerpts.

Leave a Reply to Mikko Saari Cancel reply

Are you a Relevanssi Premium customer looking for support? Please use the Premium support form.

Your email address will not be published. Required fields are marked *