It would be a lot easier if you used categories for your major groups/themes.
And then instead of having hundreds of categories each containing the same 18 products as every other category, make your current "categories" into "products", and use attributes to control the selection of desired variations.
Then you wouldn't have to fiddle with creating custom search scripts just to create subcats for shopping.



