deleted items still showing in suggestions

  • ali.h@sela.ae
    Participant
    # 3 weeks, 4 days ago

    Hello Team,
    when deleting items from woocommerce via
    wp_delete_post($id)
    OR
    $product = wc_get_product($id);
    $product->delete();
    The items still show in the suggestions dropdown without image or link, but it doesn’t show in search page.
    Suggestions

    • This topic was modified 3 weeks, 4 days ago by wpsolr.
    wpsolr
    Keymaster
    # 3 weeks, 4 days ago

    Can you verify in your index that your product is no more there?

    ali.h@sela.ae
    Participant
    # 3 weeks, 4 days ago

    Yes it is still in the index.
    Here is the screenshot of the response of a direct call to elastic search.
    Index not deleted

    wpsolr
    Keymaster
    # 3 weeks, 4 days ago

    WPSOLR removes a post from the index when the WP ‘save_post’ hook is sent, for instance when a post is trashed.

    But I just noticed that wp_delete_post() does not send the hook ‘save_post’.
    To fix this issue, the hook ‘after_delete_post’ will be added on next WPSOLR release.

    For now, you could trash the product before deleting it to remove it from the index.

    Or change line 116 of file /wpsolr-pro/wpsolr/core/wpsolr_include.inc.php :

    
    add_action( 'save_post', 'add_remove_document_to_solr_index', 999, 3 );
    

    with:

    
    add_action( 'save_post', 'add_remove_document_to_solr_index', 999, 3 );
    do_action( 'after_delete_post', 'add_remove_document_to_solr_index', 10, 2 );
    
    • This reply was modified 3 weeks, 4 days ago by wpsolr.
    ali.h@sela.ae
    Participant
    # 3 weeks, 4 days ago

    Thank you

    ali.h@sela.ae
    Participant
    # 3 weeks, 3 days ago

    Hello Support
    This fix did not resolve the issue.
    Please help urgently we cannot delete the index every bit and reindex again, we have more than 500k items.

    ali.h@sela.ae
    Participant
    # 3 weeks, 2 days ago

    Additionally, even when a product is deleted or trashed from the dashboard, it does not get removed from the index.

    wpsolr
    Keymaster
    # 3 weeks, 1 day ago

    Additionally, even when a product is deleted or trashed from the dashboard, it does not get removed from the index.

    This error appeared after the custom code you just applied?

    ali.h@sela.ae
    Participant
    # 3 weeks, 1 day ago

    No, it was there even before.

    ali.h@sela.ae
    Participant
    # 3 weeks, 1 day ago

    There is another issue we also noticed when we first installed the plugin.
    we are using Dokan with woocommerce, when we disable a vendor, their products do not get removed from the index also. but I will open a separate thread for this as I need the check the status of products when the vendor is disabled

    wpsolr
    Keymaster
    # 3 weeks, 1 day ago

    WPSOLR will not work with Dokan. Only current extensions are supported.

    ali.h@sela.ae
    Participant
    # 3 weeks, 1 day ago

    Ok, what about the deleted items issue?

    wpsolr
    Keymaster
    # 3 weeks, 1 day ago

    Unfortunately, Dokan not being tested with WPSOLR, I cannot answer.

    ali.h@sela.ae
    Participant
    # 3 weeks, 1 day ago

    But delete is done from Woocommerce dashboard, and we are using WordPress’s (wp_delete_post and wp_trash_post) and Woocommerce’s ($product->delete()) core functionalities to delete products and it is not working

    wpsolr
    Keymaster
    # 3 weeks, 1 day ago

    Deactivate Dokan, and delete a product from the WooCommerce dashboard. Do you see the “Deleted from the index” message from WPSOLR?

Viewing 15 posts - 1 through 15 (of 23 total)

You must be logged in to reply to this topic.