Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query categories recursively #366

Open
Yelinz opened this issue Oct 25, 2023 · 1 comment
Open

Query categories recursively #366

Yelinz opened this issue Oct 25, 2023 · 1 comment

Comments

@Yelinz
Copy link
Member

Yelinz commented Oct 25, 2023

How should the category filter on the documents traverse the child categories to return all documents from parent and children.
Currently it will only do one layer of children

I think if we need to query categories recursively, we should either use something like MPTT, or cache the parents of each category in an ArrayField. Recursively iterating in a query is a bad idea performance-wise.
Since we didn't have positive-only experience with MPTT, I would suggest adding a all_parents = ArrayField(CharField()) to the category model, add a bit of code to keep them updated, and the query basically becomes all_parents__contains=my_category_slug

Originally posted by @winged in #365 (comment)

@czosel
Copy link
Contributor

czosel commented Nov 16, 2023

As of now, support for arbitrary nesting of categories is not something we plan to add to the frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants