We could do a lot of different things here, from keeping everything in one function that accepts complex filtering/searching on the one hand, to breaking out different methods for getProductsByCategory, getProductsByTag, getProductsByAttributeFilter etc etc. Also not sure getProducts and search are different.
Here is a proposal:
- simple
search method that accepts complex args / filters
- simple methods to provide syntactic sugar, but internally use the core search method