Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-08-17 18:39:00

etc
Developer
Registered: 2010-11-11
Posts: 5,239
Website GitHub

Re: Slow adding New Categories

Single category actions (create, edit) seem to work well and much faster now. Using two db queries per each category to update just one was crazy. But batch (multi-widget) operations still work the old way. The query to rebuild the whole tree in one go when updating a dozen of nodes seems to become too complicated. Can’t see a solution for this atm…

Offline

#14 2021-08-18 01:53:04

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,225
Website

Re: Slow adding New Categories

This does not seem to be related to the category changes discussed above.
But, isn’t this odd ? Or wrong ?

  • A category is assigned to one or more articles
  • On the category panel, select (check) the category
  • Using the multi-edit widget, select Delete.
  • The usual JS alert “are you sure” follows, OK.

Something happens as the page reloads. But. There is no feedback from Textpattern – no messagepane. The category is not deleted. Luckily, as that is expected.

Deleting an empty category, not assigne to any article, I do get the the expected message (success).

If I try the same on the Articles panel, I do get an error message: Could not delete section(s), articles are currently assigned: articles., as expected.

Tested on 4.8.8-dev latest, 4.9.0-dev and 4.8.7 release (live server). No debug spew…


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#15 2021-08-18 08:00:58

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,540
Website GitHub Twitter

Re: Slow adding New Categories

Bloke wrote #331396:

First off, the optimisations here are amazing, so thank you Oleg for sorting this.

Yes thanks to Oleg it s amazing.

Secondly, the lack of pagination in the Categories panel is, bluntly, annoying. However, displaying it in a table or some other format is fraught with difficulty. Mainly because:

  • There’s no neat way to show hierarchy in a tabular format, beyond repeating ‘parent’ info in its own column. And even then, you’d only see one level above the current one, unless the ‘breadcrumb’ trail was shown per record.
  • If you search for something and it appears as a subset of another record, again, it’s a dangling child so you need some way to show that it’s connected to the hierarchy somehow.
  • If you paginate, say, 24 records at a time and there are 40 elements under the first parent, then on page 2 of the results, how do you show that elements 25-40 belong to the parent and that there are others at the same level?

I agree with you pagination has no place in category tab

I had a stab at a revised UX flow, what, maybe a decade ago. Perhaps longer. And it was horrible. It offered a flip between ‘category’ mode and ‘list’ (table) mode, and the tables had a clickable ‘parent’ column so you could filter by them, and there was a way to navigate back up the chain in the same column.

Splitting them by type helped so there were separate sets for article, image, file, link. The ability to retain the rapid category creation under the current parent is something I’d be keen to keep, but it’d also be nice to batch-create categories across type, for those times when you want to link articles and files by category. Shame there has to be duplication involved, but it’d be better than nothing.

But none of that solves the problem of how to reasonably display 1000+ categories in a hierachy, as that’s a lot of data to squirt down the pipe to draw each page.

We can improve a little more the category page by:

  • putting each category type (article, image, file, links) in tabs that way we will have more space for each one
  • Making the tree using ul/li construction instead of <p> and add (+) and (-) to show/hide children for each parent
  • Add an input field under create to filter the tree by javascript to find a categroy quickly
  • Change the input field to create category into a textarea to add multipple categories with same parent at once

All above idea can be made by a plugin so if people are not seing them useful for the majority of users.
(look at dzd_txp_select2 a tiny plugin that help me find a parent category quickly and inserting a category in write tab quickly).

Dragondz: Would your solution be improved by using tags? Because we’re thinking of repurposing the Keywords field to effectively work as a comma-separated list of freeform(ish) tags. Or is the hierarchy important in this case?

Bear in mind in the meantime there’s also smd_tags, which is a halfway house between categories and tagging (although it stores them in the same way as core, so if you have thousands it might be just as slow until I can update the plugin to use Oleg’s new DB function).

smd_tags can be configured to hook into categories and essentially pre-filter the available tags based on category. So if the user picks the Marvel category then only tags Black Widow, Iron Man, Ant-man, Captain America, etc appear as options. If they pick the DC category, then they’d only get Superman, Batman, etc as tag choices. There are also ‘global’ tags that are available regardless of category if you wish.

That functionality allows you to split the categorisation between core cats, and plugin tags, to help make tag selection more manageable without having to categorise everything.

Just a thought.

I am not sure, because there a parent/child relation i find it natural to use category for that, the slowlyness is only in adding the categories and it s a one time work.

Thanks for sharing your thought Stef.

Offline

#16 2021-08-18 09:41:52

etc
Developer
Registered: 2010-11-11
Posts: 5,239
Website GitHub

Re: Slow adding New Categories

phiw13 wrote #331405:

This does not seem to be related to the category changes discussed above…

Nope.

There is no feedback from Textpattern – no messagepane. The category is not deleted. Luckily, as that is expected.

If I try the same on the Articles panel, I do get an error message: Could not delete section(s), articles are currently assigned: articles., as expected.

There is even no such string for categories.

Offline

#17 2021-08-18 09:45:17

etc
Developer
Registered: 2010-11-11
Posts: 5,239
Website GitHub

Re: Slow adding New Categories

Clearly, txp was not designed with thousands of categories in mind. BTW, Rabah, how long does it take on the public side to output

<txp:category_list children sort="name DESC" wraptag="ul" break />

Offline

#18 2021-08-18 09:57:00

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,225
Website

Re: Slow adding New Categories

etc wrote #331411:

Nope.

There is even no such string for categories.

Old issue then… :-( Worth a Github issue


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#19 2021-08-18 10:59:49

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,540
Website GitHub Twitter

Re: Slow adding New Categories

etc wrote #331412:

Clearly, txp was not designed with thousands of categories in mind. BTW, Rabah, how long does it take on the public side to output

<txp:category_list children sort="name DESC" wraptag="ul" break />...

Hi Oleg

Yes txp in not designated for such amount, but it works even with that amount, then it s ok no ? And the improvements i am looking can be made by plugin then it s fine.

A complete page containing the categories (but not only):

<!-- Trace summary:
Runtime   : 550,79 ms
Query time: 217,07 ms
Queries   : 985
Memory (*): 11849 kB
-->

PS: The only change that could made in core is this one maybe :
Making the tree using ul/li construction instead of <p>.

Offline

#20 2021-08-18 13:30:26

etc
Developer
Registered: 2010-11-11
Posts: 5,239
Website GitHub

Re: Slow adding New Categories

Dragondz wrote #331415:

Yes txp in not designated for such amount, but it works even with that amount, then it s ok no ?

It is ok if there is no better way, but there seem to be a room for improvement in txp categories management.

A complete page containing the categories (but not only): … Queries : 985

Wow, that’s way too many, where are they coming from? Theoretically (and my tests confirm it), the whole tree should be retrieved in a single query, please check in debug mode if you can.

PS: The only change that could made in core is this one maybe :
Making the tree using ul/li construction instead of <p>.

You mean public side? BW-compatibility, when you hold us…

Offline

#21 2021-08-18 14:08:05

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,540
Website GitHub Twitter

Re: Slow adding New Categories

etc wrote #331416:

Wow, that’s way too many, where are they coming from? Theoretically (and my tests confirm it), the whole tree should be retrieved in a single query, please check in debug mode if you can.

Ah sorry i havent precised it was with txp 4.8.7, with the 4.8.8 and a page containing txp:categort_list i got this one :

<!— Trace summary:
Runtime : 236,95 ms
Query time: 18,62 ms
Queries : 10
Memory (*): 9591 kB
—>

You mean public side? BW-compatibility, when you hold us…

I mean backend.

Offline

#22 2021-08-18 20:06:02

etc
Developer
Registered: 2010-11-11
Posts: 5,239
Website GitHub

Re: Slow adding New Categories

Dragondz wrote #331419:

Queries : 10

Ah, fine then, we could probably loosen the storage format, to make the tree modifications faster.

I mean backend.

The markup should be easy to modify, dunno re styling ul lists. There are checkboxes to align.

Offline

#23 2021-08-19 04:35:55

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,225
Website

Re: Slow adding New Categories

etc wrote #331425:

The markup should be easy to modify, dunno re styling ul lists. There are checkboxes to align.

The styling is not terribly difficult, even the alignment of the checkboxes is fairly easy. More complex would be implementing a show/hide mechanism for the child categories as suggested by Rabah above. Particularly, the interaction(s) with the multi-edit widget would need some attention…


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#24 2021-08-21 12:42:32

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,540
Website GitHub Twitter

Re: Slow adding New Categories

phiw13 wrote #331429:

The styling is not terribly difficult, even the alignment of the checkboxes is fairly easy. More complex would be implementing a show/hide mechanism for the child categories as suggested by Rabah above. Particularly, the interaction(s) with the multi-edit widget would need some attention…

Hi,

I only wanted to have the markup be changed to ul/li, the hide show mechanism will easily be made by a simple plugin, because i dont think a lot of people are using a lot of categories.

Cheers.

Offline

Board footer

Powered by FluxBB