BTreeFolder2 questions

Hello,

From what I have read, I have seemed to understand that the folders (root and all others) of Plone 5.1 and later are BTreeFolder2. Correct?

If I have tens of thousands of items in a BTreeFolder2 folder and I want to change the order of a single item (for example, so that a new item appears second instead of last), can I easily do it without dragging it?

If I want to make a directory website with unlimited people:
mysite.es/person1
mysite.es/person2
mysite.es/person3
...
what would be better? Host all people in Plone root folder or host them in a subfolder and use rewrite rules?

Thanks,

Manuel

In my newly installed Plone 5.2, none of the normal folders are BTreeFolder2. I dont remember about 5.1, but I think it should be the same.

I am not sure what is the right approach here, but basically I would say this.

It is not a good idea to have a lot of content in the root folder. It is better to keep them in folders.

If you dont want to drag items, I would suggest using a smart folder ( what used to be called 'Collection') to show the items. Then you could add some logic for: 'in which order to view it'. For example sort on 'Modified' or Published. If you modify an item it will 'show first'. Thern you modify another and the new will show first and this second.

If you have a lot of items, I would suggest using collective.collectionfilter or something similar to make it easy for the visitor to sort. It can work like this: - YouTube

Personally, I dont like to overpopulate the root folder (but it is a 'personal' , not a technical answer), so I would put person1 etc in 'persons' folder. That said: would it matter if the urls were mysite.es/persons/person3 ?

Likely, almost folders in Plone implement IOrderedContainer.

So you can use

ordered_folder = IOrderedContainer(obj,aq_parent)
ordered_folder.moveObjectToPosition(obj.getId(), position)
obj.reindexObject(idxs=['getObjPositionInParent'])

for moving content programmatically.

But usually you have some criteria like sort by title, sort by some date etc. for generating listings and overview pages...that's where you would use the portal_catalog for searching and sorting content.

Thanks, Espen.

My newly installed Plone 5.1.6 site includes the following egg by default: Products.BTreeFolder2-2.14.0. Do I have to do something to activate it?

According to Products.BTreeFolder2 ยท PyPI "BTreeFolder2 solves this issue. It stores not only the subobjects but also the IDs of the subobjects in a BTree. It also batches the list of items in the UI, showing only 1000 items at a time. So if you write your application carefully, you can use a BTreeFolder2 to store as many items as will fit in physical storage.".

I will try to import or programmatically create 100,000 items in the root folder and in a subfolder, to see what happens (I will stay away from the laptop in case it explodes ...).

ordered_folder = IOrderedContainer(obj,aq_parent)
ordered_folder.moveObjectToPosition(obj.getId(), position)
obj.reindexObject(idxs=['getObjPositionInParent'])

Noted (I'll test it).

Thanks!

BTreeFolder2 is used internally by Plone to provide support for large folders. It is not used directly (and you should not do it) because it lacks Plone content features. In particular, it has no ordering support.

Someone that is more used to very large sites should answer, since I am not sure if I know enough about this.

That said, unless there is a very good reason to stick with Plone 5.1, I would upgrade to 5.2 and then put all the 'persons folders' in the Members folder and maybe duplicate the Members folder if you need another very large folder (since the members folder is 'supposed to have many items'. You should change the settings in the control panel (/@@usergroup-controlpanel ) and enable 'many users'. And maybe activate 'members folder' in /@@security-controlpanel if you need that:

PS: I got the info about 'persons folder' in another message, it was not in this 'question'.

Plone Foundation Code of Conduct