Building the category tree from attributes
I build the tree from how buyers compare products, using entity–attribute–value (EAV) modelling: the entity (an engagement ring), its attributes (metal, setting style, stone type) and their values (platinum, halo, lab-grown diamond). The attributes that shape buying decisions decide the tree’s depth. A jewelry store might need metal and stone type as levels, while a CBD store might need spectrum and format. The result matches real query patterns instead of the warehouse’s stock codes.