• This plugin was working really well for our site but all of a sudden, it has started producing 0 results. If I disable the plugin, the results come in again (but obviously not as relevant). When I enable the relevanssi plugin again, it says “No products were found matching your selection.” I have stripped the site back to use the 2016 theme, and ONLY have WooCommerce and Relevansi plugins active and the same is happening. Any help with this would be appreciated.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Have you tried rebuilding the index?

    Thread Starter stowbee

    (@stowbee)

    Yes tried that but no luck unfortunately. I’ve been trying to think what might have changed and I remember now that I did change the shop permalink from default to shop base. Could this have caused a problem in the db? I have tried re indexing since then though. I also tried uninstalling and reinstalling the plugin but no good.

    Plugin Author Mikko Saari

    (@msaari)

    No, permalinks shouldn’t affect this. Which version of Relevanssi you have? The latest?

    Couple of things you can test:

    add_filter('relevanssi_query_filter', 'rlv_qf_test');
    function rlv_qf_test($q) {
        var_dump($q);
        return $q;
    }

    If you put this into your theme functions.php and run a search, does it print out something?

    add_filter('relevanssi_search_ok', 'rlv_so_test');
    function rlv_so_test($ok) {
        global $wp_query;    
        var_dump($wp_query->query_vars);
        return $ok;
    }

    What about this?

    Thread Starter stowbee

    (@stowbee)

    Hi. Thanks for your help. Much appreciated. The 1st block of text outputs:
    string(813) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE relevanssi.term = 'discovery' AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))" string(807) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE relevanssi.term = '200' AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))" string(833) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE (term LIKE '%discovery' OR term LIKE 'discovery%') AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))" string(821) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE (term LIKE '%200' OR term LIKE '200%') AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))" string(813) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE relevanssi.term = 'discovery' AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))" string(807) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE relevanssi.term = '200' AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))" string(833) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE (term LIKE '%discovery' OR term LIKE 'discovery%') AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))" string(821) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.75 + relevanssi.tag * 0.75 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi INNER JOIN wp_postmeta ON ( relevanssi.doc = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( relevanssi.doc = mt1.post_id ) WHERE (term LIKE '%200' OR term LIKE '200%') AND ( ( wp_postmeta.meta_key = '_visibility' AND wp_postmeta.meta_value IN ('visible','search') ) AND ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' ) ) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('product'))) OR (doc = -1))"

    The 2nd outputs:
    array(71) { ["s"]=> string(13) "discovery 200" ["post_type"]=> string(7) "product" ["error"]=> string(0) "" ["m"]=> string(0) "" ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["author"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["meta_key"]=> string(11) "total_sales" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["sentence"]=> string(0) "" ["title"]=> string(0) "" ["fields"]=> string(0) "" ["menu_order"]=> string(0) "" ["embed"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["post_name__in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(0) { } ["tag_slug__and"]=> array(0) { } ["post_parent__in"]=> array(0) { } ["post_parent__not_in"]=> array(0) { } ["author__in"]=> array(0) { } ["author__not_in"]=> array(0) { } ["orderby"]=> string(16) "menu_order title" ["order"]=> string(3) "ASC" ["meta_query"]=> array(1) { ["visibility"]=> array(3) { ["key"]=> string(11) "_visibility" ["value"]=> array(2) { [0]=> string(7) "visible" [1]=> string(6) "search" } ["compare"]=> string(2) "IN" } } ["tax_query"]=> array(0) { } ["posts_per_page"]=> int(15) ["wc_query"]=> string(13) "product_query" ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["lazy_load_term_meta"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["search_terms_count"]=> int(2) ["search_terms"]=> array(2) { [0]=> string(9) "discovery" [1]=> string(3) "200" } ["search_orderby_title"]=> array(2) { [0]=> string(38) "wp_posts.post_title LIKE '%discovery%'" [1]=> string(32) "wp_posts.post_title LIKE '%200%'" } }

    Thread Starter stowbee

    (@stowbee)

    I was running the latest 3.5.5 yes, but then tried installing the previous version 3.5.4 to see if that helped but same problem (O results).

    Plugin Author Mikko Saari

    (@msaari)

    ( mt1.meta_key = 'total_sales' AND mt1.meta_value = '' )`

    This might be a problem. Your search is set to only return results with “total_sales” custom field set to an empty value. Is that on purpose?

    Thread Starter stowbee

    (@stowbee)

    Hi – No this is not on purpose and I’m not even sure how I would set/unset that?

    Plugin Author Mikko Saari

    (@msaari)

    See instructions here, you may also want to enable the price and sales sorting in search results.

    Thread Starter stowbee

    (@stowbee)

    Hi. Thank you! I’m now getting results! The only issue with this is that for general shop browsing and viewing shop categories, I need it to order the results by popularity (which it does now). However, although by adding the code above, I now have the search results coming in, they are also ordered by popularity too. What was so great about Relevanssi when it was working before is that it would bring back results based on the relevance. Ideally, I need to leave the default setting to be ‘sort by popularity’, but when a search is perfoirmed, the results are ‘sorted by default’ ordering (which then seems to use Relevanssi’s relevenace sorting). Is that possible? Really appreciate the help. Thank you.

    Plugin Author Mikko Saari

    (@msaari)

    Thread Starter stowbee

    (@stowbee)

    Thanks – unfortunately, this didn’t fix it for me. If in WooCommerce > Settings > Product > Display I have Default Product Sorting set to ‘Popularity (sales)‘, this overrides the Relevanssi relevenace search. If I changed the Default Product Sorting to ‘Default Sorting (custom ordering + name)’, then the Relevansi relevance sorting starts working again.

    The function in your link didn’t seem to make any difference to this for me I’m afraid.

    Plugin Author Mikko Saari

    (@msaari)

    You have something in your theme that resorts the results after Relevanssi provides them. There’s nothing Relevanssi can do about that. I’d ask on WooCommerce support forums.

    Thread Starter stowbee

    (@stowbee)

    Hi – thanks for your reply – it doesn’t have anything to do with the theme from what I can see. The same thing happens with a basic Twenty Sixteen theme with practically all plugins disabled. In a nutshell, Relevanssi works great with the: WooCommerce > Settings > Product > Display set to ‘Default Product Sorting’. As soon as I set it to ‘Popularity (sales)‘, this overrides the Relevanssi relevenace search, even with the filter added to functions that you suggest above. What I need is the normal display of products in categories to be ‘Popularity (sales)’ as set in WordPress settings described above, but when you do a search, it shows the normal relevanssi search and isn’t overruled by the WooCommerce ordering.

    I’m also having an issue where a customer is entering “exhaust Manifolds” into the search but it’s not finding the products with “exhaust Manifold” (singular) in the title. I’ve seen that you’ve mentioned that in premium there’s a simple stemmer included. We would look into getting premium for this purpose if it can’t be sorted without but obviously we would need to sort this ordering issue ideally. Thanks in advance.

    Plugin Author Mikko Saari

    (@msaari)

    Well, it’s not your theme, then, just WooCommerce. But I don’t use WooCommerce, so I don’t know how it sorts the results.

    However, if you set the default sorting to Popularity, then yes, that’s what Relevanssi will use too – that’s how you’ve set it up, if you’ve added the WooCommerce compatibility code I gave you earlier. That’s what it does, add support for those sorting methods and if the Popularity sorting is default sort, that’s what Relevanssi uses by default.

    Do you have the option on the search results page to change the sorting, and can you change it to relevancy? Ie. are the search results always locked to Popularity sorting?

    There’s no easy way to fix this, unless you want to disable Popularity sorting for search completely. If the sorting is set to Popularity, Relevanssi can’t tell if it’s the unwanted default setting or something the user has selected.

    What would solve the issue would be a WooCommerce option that lets you specify different sorting method for general product pages and searches, but I suppose WooCommerce does not have that.

    Stemming the plurals is trivial and included in Premium, yes.

    Thread Starter stowbee

    (@stowbee)

    Hi – yes you understand correctly. I can change to default sorting in woocommerce (so the Relevanssi results work nicely) but as you say, this is the same for normal category display AND results – basically site wide. There is no way to specify that search results use a different sorting. I was hoping that Relevanssi overwrote the normal product display sorting or that you could force Relevanssi to use default sorting (even if popularity sorting is set for WooCommerce). If it can’t be done, it can’t be done. Thanks so much for your support.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Plugin was working great but now 0 results’ is closed to new replies.