WPSOLR: error on term

  • 5 years, 5 months ago #11937

    Error on line 313 of file /public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php: Trying to get property ‘name’ of non-object

    getting this error

    5 years, 5 months ago #11944

    The indexing was running smoothly and indexed 54000 products and then suddenly stopped with the aforementioned error. I tried running the index again with Display debug infos during indexing and found the product id using the following SQL syntax

    SELECT ID, post_modified, post_parent, post_type FROM wp_posts AS posts WHERE ((post_modified = ‘2019-02-11 14:18:01’ AND ID > 91146) OR (post_modified > ‘2019-02-11 14:18:01’)) AND ( post_status IN (‘publish’) AND ( post_type = ‘product’ ) ) AND ID NOT IN (124038) ORDER BY post_modified ASC, ID ASC LIMIT 1

    the product id was 1224

    I edited the the product by clicking the update button and then rerun the index but it isn’t running now givving the following error

    Error on line 313 of file /public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php: Trying to get property ‘name’ of non-object

    wpsolr
    Keymaster
    5 years, 5 months ago #11948

    You can prevent indexing it with the product metabox “Do not search” checkbox.

    5 years, 5 months ago #11949

    I used that feature even trashed the product but nothing seems to work.

    wpsolr
    Keymaster
    5 years, 5 months ago #11950

    Then, it’s not that product that causes the problem.

    Edit the product, save it. What message appears in the notice header?

    5 years, 5 months ago #11951

    After trashing the product I deleted the index started it all over again again got this error error

    wpsolr
    Keymaster
    5 years, 5 months ago #11952

    Same issue on another product.

    5 years, 5 months ago #11953

    I am not certain since it does not output the error even after checking “Display debug infos during indexing”. Should I share the credentials with you to identify the exact problem ?

    wpsolr
    Keymaster
    5 years, 5 months ago #11954

    Can you repost the error here?

    (we do not access clients environment during support)

    5 years, 5 months ago #11956

    Error on line 313 of file /public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php: Trying to get property ‘name’ of non-object

    wpsolr
    Keymaster
    5 years, 5 months ago #11957

    Restart indexing with debug mode “on” and batch size “1”, until it stops in error. Then restart it once more. Check the product id in the debug trace and exclude the product with its WPSOLR metabox.

    5 years, 5 months ago #11959

    This time there is a new product
    ID 73010

    Why WPsolr is unable to index these products ? and do i need to re-run the index everytime this error pop ups ?

    It will then take forever to generate the index 🙁

    wpsolr
    Keymaster
    5 years, 5 months ago #11960

    I suspect your cleaning of taxonomies has yet to be continued.

    5 years, 5 months ago #11961

    55000 products are indexed with same taxonomies.

    wpsolr
    Keymaster
    5 years, 5 months ago #11962

    A small workaround to detect the problem origin:

    Line 313 of /public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php

    Replace

    array_push( $term_parents_names, $term_parent->name );
    
    // Add the term to the non-flat hierarchy (for filter queries on all the hierarchy levels)
    array_push( $taxonomy_non_flat_hierarchies, $term_parent->name );

    with

    if ( method_exists( $term_parent, 'name' ) ) {
    
    	array_push( $term_parents_names, $term_parent->name );
    
    	// Add the term to the non-flat hierarchy (for filter queries on all the hierarchy levels)
    	array_push( $taxonomy_non_flat_hierarchies, $term_parent->name );
    
    } else {
    
    	throw new \Exception( sprintf( "WPSOLR: term %s for taxonomy %s has no name", $term_parent_id, $parent ) );
    }
Viewing 15 posts - 31 through 45 (of 76 total)

You must be logged in to reply to this topic.