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
Product A
Product A
Product B
Product C
Product D
Product Categories
Category 1
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
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?
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
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
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
Product Categories
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:
But the page seem to be very slow, I have no idea what I should do to improve page load time.
My english is not good but hope that I have some idea to solve this problem
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
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?
How many productCategories and how many products do you have approximately?
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
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
is working on a reply...