Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nguyen Minh The 12 posts 99 karma points
    Mar 03, 2021 @ 14:29
    Nguyen Minh The
    0

    Query get all node by parent node - multi node tree picker seem to be so slow :(

    Hello comunity,

    I have a website that a lot of content and picture that has a shopping structure like this:

    Product Archives

    1. Product A
    2. Product A
    3. Product B
    4. Product C
    5. Product D

    Product Categories

    1. Category 1
    2. Category 2

    I have a multi node tree picker in Product type. So a product may in more than one category

    The problem is that my query seem to be very very slow every we query in a category to search all product that concern to the category people in

    This is how I work:

    var baseShop = Umbraco.TypedContent(14147).Descendants("product"); // I get all the product I have and then filter below:
    var listProduct = baseShop.Where(x => x.GetPropertyValue<IEnumerable<IPublishedContent>>("productCategories").Any(y => y.Id == Model.Content.Id)); // Model.Content.Id is the current categogy page user visit
    

    But the page seem to be very slow, I have no idea what I should do to improve page load time.

    • I understand that the main problem in the code like get listProduct. I think should query all the product that have relation by the category node. But I dont know how I can do. It's not like the database relationship I worked before.

    My english is not good but hope that I have some idea to solve this problem

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Mar 03, 2021 @ 22:28
    Alex Skrypnyk
    0

    Hi Nguyen

    Are you sure that filtering is slowing down the page?

    Did you check the Descendants method? It could be slow.

    Check out common Umbraco pitfalls and how to avoid - https://our.umbraco.com/documentation/reference/common-pitfalls/

    Looks like maybe you have to add product Category to the index - it will be faster.

    Thanks, Alex

  • Nguyen Minh The 12 posts 99 karma points
    Mar 04, 2021 @ 03:20
    Nguyen Minh The
    0

    Hi Alex,

    I tested it by run line by line, the Descendants line work fine, but after add the filter line, page load time will be slow down horrible. Do you have any idea to filter them?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Mar 04, 2021 @ 23:13
    Alex Skrypnyk
    0

    How many productCategories and how many products do you have approximately?

  • Nguyen Minh The 12 posts 99 karma points
    Mar 05, 2021 @ 07:23
    Nguyen Minh The
    0

    Hi Alex,

    We have 10 categories and ~200 products BUT the site has a lot of other content. We using Umbraco 7

    You can try the page load here https://noithatmanhhe.vn/tu-bep-go-cong-nghiep it's really slow when we run filter by using multi node tree picker

    Actually the multi node tree picker I use it like a tag, but by some reasons we don't use tags type. https://noithatmanhhe.vn/tu-bep you can try press to any tag product category here

  • Nguyen Minh The 12 posts 99 karma points
    Mar 05, 2021 @ 16:55
    Nguyen Minh The
    0

    Hi everyone, sorry for this comment. I think it's not a big problem but I really need to solve it for my customer. Please suggest me something I will try to do it, thanks u guys a lot

Please Sign in or register to post replies

Write your reply to:

Draft