altered getCategoryTree function (search), ref #466