• Resolved yatgirl

    (@yatgirl)


    My live woocommerce php7 site is using Relevanssi vers 4.04 – on my blogvault staging site, I updated to relevanssi ver 4.07 and now the following does not work:
    I tested the Relevanssi search in my staging site prior to updating and it worked fine.
    I did not update any other plugins other then Relevanssi

    1. Searching within product tags works in ver 4.04 – and shows no results in 4.07
    2. Searching within a specific category works in 4.04 – and shows no results in ver 4.07
    3. Searching for a plural such as flags in 4.04 brings back the max of my throttle which is 350 results and shows no results in ver 4.07

    I have tested by having both the live site open and the staging site and performing the same search, the search is not working anymore in 4.07. I have viewed the live site relevanssi plugin settings side by side with my staging site settings, they all appear to be the same as each other, but everything that is important to me, now doesnt work.

    Luckily I havent updated my live site.

    Hoping this can be fixed….

    My custom snippet for searching within categories that you had previously provided is:
    /* Relevanssi Search – Enable Search in Specific Category
    * Add this to your theme’s functions.php file
    */

    add_filter(‘relevanssi_modify_wp_query’, ‘rlv_modify_query’);
    function rlv_modify_query($query) {
    if (isset($query->query_vars[‘product_cat’])) {
    $query->query_vars[‘tax_query’][] = array(
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => $query->query_vars[‘product_cat’],
    ‘include_children’ => false,
    );
    }
    return $query;
    }

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

    (@msaari)

    Hmm, I just tested on my local environment, and if I set Relevanssi to index product_tag and product_cat, I find products with both of them without issues. Same goes for searches with a product_cat parameter: I get the expected results. So there should be nothing inherently broken in 4.0.7 in combination with WooCommerce 3.3.5.

    So the first step there is to see that product_tag and product_cat are still selected and the index is built with the settings enabled.

    Those plurals –?do the posts contain the plurals? Or are you using something to modify the search queries to make the plurals match the singulars? Relevanssi in itself without any modifications should not be able to find posts with singular form when searching for the plural.

    Thread Starter yatgirl

    (@yatgirl)

    My live site is running woo 3.3.3 but I also tested in my staging site by upgrading to woo 3.3.5 and then set it up again – not upgrading to woo 3.3.5 and just updating Relevanssi from 4.04 to 4.07- it is not woocommerce that is affecting it. I thought of that and so tried it both ways.

    I reviewed the settings between my un-updated live site and my relevanssi updated staging site and they are the essentially the same – with the exception of the new Relevanssi settings which are noted below (which were automatically changed with the Relevanssi update – not by me.)

    Re: Plurals – yes you have said this to me before – I dont know what is affecting it – but it works on Rel 4.04 and not on 4.07.

    Below are my settings – differences (which I did not change) are noted otherwise the settings are the same on both:
    INDEX – settings are exactly the same in 4.04 and 4.07 and product_tag and product_cat are both checked (enabled)
    INDEX TAB ADVANCED – advanced – there are difference between Relevanssi ver 4.04 and 4.07 which I did not change myself.
    Hyphens and Dashes 4.04-keep 4.07-replace with spaces
    Ampersands 4.04-keep 4.07-replace with spaces
    Decimal separators (new in 4.07) is blank

    SEARCHING
    Default – AND – require all terms
    Fallback – Disable the OR fallback
    Default order – Relevance
    Keyword matching – whole words
    Weights – Tag weight and category weight are new (not in Rel 4.04)- left at default (tag 3 – cat weight 2)
    Boost extra matches is new (not in Rel 4.04) – blank
    Respect exclude from search – checked
    Throttle searches – checked
    Category restrictions – blank
    Post Exclusion – blank

    I did not rebuild the index on my staging site as I have had issues with it stalling in the past (I have over 16000 products on my site) – but I can try if you like, although I wouldnt think a plugin update should make that necessary….. ?

    Plugin Author Mikko Saari

    (@msaari)

    I looked through your previous Relevanssi support threads, and looks like the plurals are coming from category titles. So – if category indexing is not working, then those plurals are not working either.

    Since all your problems right now seem to focus on taxonomies, that’s what I’d investigate next.

    1. Add this to theme functions.php and go save a product. What do you see?

    add_filter( 'pre_option_relevanssi_index_taxonomies_list', 'rlv_test_taxs' );
    function rlv_test_taxs( $option ) {
        var_dump( $option );
        exit();
    }

    2. Remove the first function, add this to theme functions.php and save a product. What does that print out?

    add_filter( 'relevanssi_tag_before_tokenize', 'rlv_list_tags' );
    function rlv_list_tags( $tag ) {
        var_dump( $tag );
        return $tag;
    }
    add_filter( 'pre_option_relevanssi_index_author', 'rlv_exit' );
    function rlv_exit( $option ) {
        exit();
    }

    With over 16 000 products, I’d also seriously look into more robust search products, with more focus on big online stores, like Lucidworks Site Search.

    Thread Starter yatgirl

    (@yatgirl)

    I saved an existing product called Collie Flag (Tri) – Starry Night (Garden)

    Your results from above snippets
    #1 Result: bool(false)
    #2 Result: string(16) “Collie Dog Flags”

    Just on the chance that this was my problem, I set up a new staging site again with Rel 4.04 and tested the searches I am having trouble with on ver 4.07. With 4.04 – they worked perfectly. I updated to Relevanssi 4.07 and everything immediately broke again – so something in the Relevanssi plugin has substantially changed since 4.04.

    Plugin Author Mikko Saari

    (@msaari)

    Hmm, the first snippet should not print out false, but on the other hand, if it does return false, the second snippet shouldn’t also print out anything, so I guess it’s still working somehow.

    Looks like Relevanssi is seeing “collie dog flags” associated with that post, then. Is that the correct list of tags and product categories for the post? Does that work as a search phrase? If you save that post, can you find it when searching for “collie dog flags”?

    If you look at the wp_relevanssi database table, is the product tag information being indexed? If you search for “flags” in the term column of the database table, do you see results? I’m trying to figure out whether this is an indexing issue or a searching issue.

    There was a huge number of changes between 4.0.4 and 4.0.5, so it’s not a surprise that you’ve seeing something –?but I still can’t reproduce any of these issues, these searches work as expected in version 4.0.7 for me, and in order to fix problems, I need to know exactly what they are.

    Thread Starter yatgirl

    (@yatgirl)

    Re: Can you find it when searching for “collie dog flags”
    That particular product belongs to the ‘collie’ category and also the ‘dog flags’ category. There are no product tags associated with this particular product.
    The search term collie dog flags shows 242 results in Rel 4.04 and 0 in Rel 4.07.

    Re database table – I unfortunately was unable to view phpmyadmin in my blogvault staging site due to a 504 Gateway timeout. I have submitted a support ticket to them about this. I was (with a third party script) able to download the database in gz format which is 12 mb. I dont know if this would be helpful to you or how I could get it to you though. Not sure if you have any other thoughts on how I can get the info you need.

    Thread Starter yatgirl

    (@yatgirl)

    I now have access to phpmyadmin in my staging site where I have Relevanssi 4.07 installed.

    Results as per your request:
    RE: Database Table wp-relevanssi – there are 470471 rows

    – Search wp_relevanssi database in term column for = ‘flags’ – shows 9040 results which agrees with the total count for the flags product category in my Relevanssi 4.04 store. The search on the front end store in my 4.07 Rel version store shows 0.

    – Search wp-relevanssi database in term column for = ‘flag’ shows 9138 results – which agrees with a search in my Relevanssi 4.04 store in admin.

    – yorkie is a product tag – if I do a = search for this in myphpadmin database term column – it shows 222 results which is what it shows on my Relevanssi 4.04 version in the front end store search. The search on the front end store in my 4.07 Rel version store shows 6 results (because the term Yorkie is in the product description) Rel vers 4.07 is not showing results for the product tags.

    So it appears all is in the database ? Just not returning the correct search results on the front end ?

    Plugin Author Mikko Saari

    (@msaari)

    Yes, looks like this is not an indexing issue then.

    Please do the first two steps from this KB page, and let me know what kind of results you get.

    Thread Starter yatgirl

    (@yatgirl)

    ——————————–
    Look at the parameters Relevanssi is getting

    array(71) { [“s”]=> string(14) “yorkshire flag” [“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(0) “” [“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(5) “title” [“order”]=> string(3) “ASC” [“meta_query”]=> array(0) { } [“tax_query”]=> array(2) { [“relation”]=> string(3) “AND” [0]=> array(4) { [“taxonomy”]=> string(18) “product_visibility” [“field”]=> string(16) “term_taxonomy_id” [“terms”]=> array(1) { [0]=> int(21) } [“operator”]=> string(6) “NOT IN” } } [“wc_query”]=> string(13) “product_query” [“posts_per_page”]=> int(100) [“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) “yorkshire” [1]=> string(4) “flag” } [“search_orderby_title”]=> array(2) { [0]=> string(168) “wp_posts.post_title LIKE ‘{d2e2a0e28a9d4b76753d026c56a90478fac28eb4b5562fb12dd8f681a8d31844}yorkshire{d2e2a0e28a9d4b76753d026c56a90478fac28eb4b5562fb12dd8f681a8d31844}'” [1]=> string(163) “wp_posts.post_title LIKE ‘{d2e2a0e28a9d4b76753d026c56a90478fac28eb4b5562fb12dd8f681a8d31844}flag{d2e2a0e28a9d4b76753d026c56a90478fac28eb4b5562fb12dd8f681a8d31844}'” } }

    ——————————–
    Look at the MySQL query

    string(693) “SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5000 + relevanssi.content * 1 + relevanssi.comment * 0.75 + relevanssi.tag * 3 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 2 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi WHERE relevanssi.term = ‘yorkshire’ AND relevanssi.doc NOT IN (SELECT DISTINCT(tr.object_id) FROM wp_term_relationships AS tr WHERE tr.term_taxonomy_id IN (21)) AND ( relevanssi.doc IN ( SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN (‘product’) ) ) ORDER BY tf DESC LIMIT 350”

    Thread Starter yatgirl

    (@yatgirl)

    The search above was for yorkshire flag and returned a not bad ressult.

    Below is a search for yorkie flags. On my ver 4.04 store it brings back 140 results. On my 4.07 store it brings back nothing. Yorkie is a product tag. Flags is a category.

    ——————————–
    Look at the parameters Relevanssi is getting

    array(71) { [“s”]=> string(12) “yorkie flags” [“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(0) “” [“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(5) “title” [“order”]=> string(3) “ASC” [“meta_query”]=> array(0) { } [“tax_query”]=> array(2) { [“relation”]=> string(3) “AND” [0]=> array(4) { [“taxonomy”]=> string(18) “product_visibility” [“field”]=> string(16) “term_taxonomy_id” [“terms”]=> array(1) { [0]=> int(21) } [“operator”]=> string(6) “NOT IN” } } [“wc_query”]=> string(13) “product_query” [“posts_per_page”]=> int(100) [“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(6) “yorkie” [1]=> string(5) “flags” } [“search_orderby_title”]=> array(2) { [0]=> string(165) “wp_posts.post_title LIKE ‘{940325c3d17ecaf666becf3296d57a8bafac2d1e10e81917b522d1345a48cc1d}yorkie{940325c3d17ecaf666becf3296d57a8bafac2d1e10e81917b522d1345a48cc1d}'” [1]=> string(164) “wp_posts.post_title LIKE ‘{940325c3d17ecaf666becf3296d57a8bafac2d1e10e81917b522d1345a48cc1d}flags{940325c3d17ecaf666becf3296d57a8bafac2d1e10e81917b522d1345a48cc1d}'” } }

    ——————————–
    Look at the MySQL query

    string(690) “SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5000 + relevanssi.content * 1 + relevanssi.comment * 0.75 + relevanssi.tag * 3 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 2 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi WHERE relevanssi.term = ‘yorkie’ AND relevanssi.doc NOT IN (SELECT DISTINCT(tr.object_id) FROM wp_term_relationships AS tr WHERE tr.term_taxonomy_id IN (21)) AND ( relevanssi.doc IN ( SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN (‘product’) ) ) ORDER BY tf DESC LIMIT 350”

    Plugin Author Mikko Saari

    (@msaari)

    Nothing unusual there, just the typical WooCommerce product visibility filter. But that shouldn’t be an issue.

    So if you search for “yorkie flags”, you get nothing. What about just “yorkie” or just “flags”?

    Thread Starter yatgirl

    (@yatgirl)

    I did both those exact searches on the front end of both stores and in php myadmin above and gave you the results above in a previous reply. Or do you mean to do them with those code snippets ?

    Plugin Author Mikko Saari

    (@msaari)

    Ah, sorry, didn’t notice that before. Since even single word searches fail, this can’t be a throttle issue; that’d be a good explanation for failing multi word searches.

    Do the last check on the KB page. That’s a good way to determine whether the problem is really with Relevanssi or if something else is messing up the proper results from Relevanssi.

    Do you use WPML or Polylang? Any membership plugins? Any filters and restrictions on who gets to see what posts?

    Thread Starter yatgirl

    (@yatgirl)

    Last check on KB Page – Result: array(0) { }

    No – Do you use WPML or Polylang? Any membership plugins? Any filters and restrictions on who gets to see what posts?

    Plugin Author Mikko Saari

    (@msaari)

    Ok, so Relevanssi is not returning results. Then the question is – where are the results that Relevanssi found eliminated?

    Does this return anything?

    add_filter( 'relevanssi_results', 'rlv_check_results' );
    function rlv_check_results( $results ) {
        var_dump( $results );
        exit();
    }

    If that returns nothing, what about this?

    add_filter( 'relevanssi_match', 'rlv_match' );
    function rlv_match( $match ) {
        var_dump( $match );
        return $match;
    }

    If that finds something, then this?

    add_filter( 'relevanssi_post_ok', 'rlv_post_ok' );
    function rlv_post_ok( $post_ok ) {
        var_dump( $post_ok );
        return $post_ok;
    }

    These should help pinpoint where the problem is.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Relevanssi Search is broken with ver 4.07’ is closed to new replies.