WPSOLR: error on term

  • 4 years, 11 months ago #11978

    Where should I add this code ?

    wpsolr
    Keymaster
    4 years, 11 months ago #11979

    Replace the previous workaround code.

    4 years, 11 months ago #11980

    I think I placed the code wrongly

    Error on line 313 of file /home/262510.cloudwaysapps.com/rusnfygwrz/public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php: First parameter must either be an object or the name of an existing class

    foreach ( $term_parents_ids as $term_parent_id ) {
    $term_parent = get_term( $term_parent_id, $parent );

    if ( $term_parent instanceof \WP_Error ) {
    throw new \Exception( sprintf( ‘WPSOLR: error on term %s for taxonomy \’%s\’: %s’, $term_parent_id, $parent, $term_parent->get_error_message() ) );
    }

    if ( property_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 {
    // Some taxonomies do not have the property name. Probably due to bad imports.

    throw new \Exception( sprintf( “WPSOLR: term %s for taxonomy %s has no name: %s”, $term_parent_id, $parent, print_r( $term_parent, true ) ) );
    }
    }

    // Add the term to the flat hierarchy
    array_push( $taxonomy_flat_hierarchies, implode( WpSolrSchema::FACET_HIERARCHY_SEPARATOR, $term_parents_names ) );

    // Add the term to the taxonomy
    array_push( $nm1_array, $term->name );

    wpsolr
    Keymaster
    4 years, 11 months ago #11981

    remove the last:

    // Add the term to the flat hierarchy
    array_push( $taxonomy_flat_hierarchies, implode( WpSolrSchema::FACET_HIERARCHY_SEPARATOR, $term_parents_names ) );
    
    // Add the term to the taxonomy
    array_push( $nm1_array, $term->name );
    4 years, 11 months ago #11982

    https://pastebin.com/B6Vk3Xec

    please view and amend the code, It’s difficult for me to play with this code

    wpsolr
    Keymaster
    4 years, 11 months ago #11983

    It looks ok.

    4 years, 11 months ago #11984

    Generating this error after indexing 50,001 products. I know i am taking too much of your time, but i want to make this plugin work for me

    Error on line 313 of file /home/262510.cloudwaysapps.com/rusnfygwrz/public_html/wp-content/plugins/wpsolr-pro/wpsolr/core/classes/models/post/class-wpsolr-model-post.php: First parameter must either be an object or the name of an existing class

    wpsolr
    Keymaster
    4 years, 11 months ago #11985

    Copy here line 313

    4 years, 11 months ago #11986

    if ( property_exists( $term_parent, ‘name’ ) ) {

    wpsolr
    Keymaster
    4 years, 11 months ago #11987

    replace line with
    if ( $term_parent && property_exists( $term_parent, 'name' ) ) {

    4 years, 11 months ago #11988

    Nothing fruitful. The same “error on term” message is displayed.

    wpsolr
    Keymaster
    4 years, 11 months ago #11989

    Please copy the error message here.

    4 years, 11 months ago #11991

    PSB

    WPSOLR: term 10733 for taxonomy strength has no name:

    wpsolr
    Keymaster
    4 years, 11 months ago #11992

    Replace
    throw new \Exception( sprintf( "WPSOLR: term %s for taxonomy %s has no name: %s", $term_parent_id, $parent, print_r( $term_parent, true ) ) );

    with
    continue;

    It will simply ignore the faulty category.

    4 years, 11 months ago #11993

    Indexing completed, thanks for the fix.

    Does this fix excludes products with the problem or it indexes them as well ?

    If it excluded those products, is there a way to get the list of excluded products / products not in index?

Viewing 15 posts - 61 through 75 (of 76 total)

You must be logged in to reply to this topic.