Indexing similar category paths moves products to other categories

  • wpsolr
    Keymaster
    3 years, 9 months ago #20899

    I configured your use case on my environment, with no issue:

    Image woocommerce-subcategories-with-same-names.png of

    Image woocommerce-subcategories-with-same-names-filter-1.png of

    Image woocommerce-subcategories-with-same-names-filter-2.png of

    wpsolr
    Keymaster
    3 years, 9 months ago #21126

    To resume our investigations up to now:
    – The url parameters are correct (parent and child category are selected)
    – The Elasticsearch query is not correct (only child category is selected, which explains the issue)

    giannissak
    Participant
    3 years, 9 months ago #21149

    Hi Patrice
    I’m John we can start talk together about the energy-sport.gr
    can you inform me what you need to proceed with the debuging;

    wpsolr
    Keymaster
    3 years, 9 months ago #21163

    Hi John,

    Let’s try to print out the query parameters.

    Edit /wp-content/plugins/wpsolr-pro/wpsolr/core/classes/ui/class-wpsolr-query.php on line 197, and comment out

    public function set_filter_query_fields( $fq ) {
    		// Ensure fq is always an array
    		$this->wpsolr_filter_query = empty( $fq ) ? [] : ( is_array( $fq ) ? array_unique( $fq ) : [ $fq ] );
    
    		return $this;
    	}

    and add

    public function set_filter_query_fields( $fq ) {
    		// Ensure fq is always an array
    		$this->wpsolr_filter_query = empty( $fq ) ? [] : ( is_array( $fq ) ? array_unique( $fq ) : [ $fq ] );
    
    		echo wp_json_encode($this->wpsolr_filter_query);
    		echo '<br>';
    
    		return $this;
    	}

    Let me know what traces you see.

    • This reply was modified 3 years, 9 months ago by wpsolr.
    gkandylakis
    Participant
    3 years, 9 months ago #21165

    i inserted the code you asked in the site and it gave me the following on the wrong filters.

    [“product_cat_str:\u039c\u03a0\u0391\u03a3\u039a\u0395\u03a4”]

    on the link

    https://www.energy-sport.gr/product-category/eshop/man/menshoes/?wpsolr_fq%5B0%5D=product_cat_str%3A%CE%9C%CE%A0%CE%91%CE%A3%CE%9A%CE%95%CE%A4

    I also made the version of elasticsearch the same as the one on the isneakers server just to notice that the problem is also there too. It wasn’t apparent due to the depth of the sub categories you had to go to notice it.

    https://staging.isneakers.gr/product-category/eshop/man/menshoes/

    https://www.energy-sport.gr/product-category/eshop/man/menshoes/

    both are identical sites

    the problem is not on the filtering side of things but i believe it is on the indexing. You can give us a demo elasticsearch database to send the data from your plugin so that you can investigate further.

    wpsolr
    Keymaster
    3 years, 9 months ago #21166

    Your url shows:
    Fatal error: Uncaught Elasticsearch \ Common \ Exceptions \ NoNodesAvailableException: No alive nodes found in your cluster

    Your Elasticsearch index is not there anymore.

    wpsolr
    Keymaster
    3 years, 9 months ago #21167

    The url you sent contains only one filter. We should have two, because selecting a child category automatically selects its parent(s).

    gkandylakis
    Participant
    3 years, 9 months ago #21168

    elasticsearch service had stopped. I restarted it.

    Selecting a parent category and narrowing down the filters by brand or size seem to work fine without having the category problems.

    this is the path when selecting brand first
    https://www.energy-sport.gr/product-category/eshop/?wpsolr_fq%5B0%5D=product_cat_str%3A%CE%91%CE%9D%CE%94%CE%A1%CE%91%CE%A3&wpsolr_fq%5B1%5D=product_cat_str%3A%CE%A0%CE%91%CE%A0%CE%9F%CE%A5%CE%A4%CE%A3%CE%99%CE%91&wpsolr_fq%5B2%5D=product_cat_str%3A%CE%9C%CE%9F%CE%94%CE%91%CE%A3&wpsolr_fq%5B3%5D=product_brand_str%3ANEW%20BALANCE

    [“product_cat_str:\u0391\u039d\u0394\u03a1\u0391\u03a3″,”product_cat_str:\u03a0\u0391\u03a0\u039f\u03a5\u03a4\u03a3\u0399\u0391″,”product_cat_str:\u039c\u039f\u0394\u0391\u03a3″,”product_brand_str:NEW BALANCE”]

    i narrowed down the problem on what i think is the source. Going directly to the category and having more than 2 sub categories the problem starts to appear

    if i browse on

    https://www.energy-sport.gr/product-category/eshop/man/menshoes/

    the problem appears because it only reads the remaing subcategories that is

    product_cat_str:\u039c\u039f\u0394\u0391\u03a3

    but by clicking on the similar named category

    https://www.energy-sport.gr/product-category/eshop/boy/boysshoes/

    the subcategory ΜΟΔΑΣ is also there but this one has sub categories on itself but the product_cat_str is the same

    product_cat_str:\u039c\u039f\u0394\u0391\u03a3

    So the problem here i noticed is that categories are not being tracked by slug that is forcibly unique by the platform but by name that can be the same in all categories without any limits.

    gkandylakis
    Participant
    3 years, 9 months ago #21169

    The proof of concept stands true when i changed the ΜΟΔΑΣ in the other categories the problem disappeared completely

    gkandylakis
    Participant
    3 years, 9 months ago #21170

    The problem still is there for all the other categories that share similar names between them. Can we change something to make it use the category slug instead of category name?

    wpsolr
    Keymaster
    3 years, 9 months ago #21171

    When I test your environment, all seems ok.

    Can you copy here a screenshot of the problem, with the corresponding url? (and in English)

    gkandylakis
    Participant
    3 years, 9 months ago #21190

    I already send you 3 times images of the problem. The site has on the top right corner a translator so you can pick language there. You can test it on your own by making the followin categories in a test enviroment

    category 1 path
    root>men>fashion>shoes

    and under the same root
    category 2 path
    root>women>fashion>shoes>running

    and you navigate to the first category

    root>men>fashion>shoes

    you will see a category filter “running”! But that category is in another path of that category tree!

    I recreated the problem to show you

    go to this link

    https://www.energy-sport.gr/product-category/root/men/fashion-men/shoes/

    and you will see the problem i described above i put 1 product in each of the previously mentioned categories like this

    https://drive.google.com/file/d/1HiqaPn91B0olkzXBjRB5FK8mXyJmYaKk/view?usp=sharing

    but if you go to the link i gave you, you will see both products and the running filter in categories as you can see in this foto

    https://drive.google.com/file/d/1xOlpIxdm_vI2EmE2JqX3_mjP9MC9KYL8/view?usp=sharing

    wpsolr
    Keymaster
    3 years, 9 months ago #21191

    Does the problem occur only on category archive pages? Or also on shop and search page?

    wpsolr
    Keymaster
    3 years, 9 months ago #21192

    (removed)

    • This reply was modified 3 years, 9 months ago by wpsolr.
    wpsolr
    Keymaster
    3 years, 9 months ago #21194

    I could replicate the issue with your last settings:
    men->fashion->shoes
    women->fashion->shoes->running

    I can investigate now.

Viewing 15 posts - 16 through 30 (of 36 total)

You must be logged in to reply to this topic.