I would guess that category name isn’t available in the product index.
Maybe you could first search for categories and use the hits from that search to add boost to your optional category ids when you make your product search.
It is better to add the category names in the product index by implementing IIndexingProviderPreProcessor and rebuild the indexes when a category name has changed.
As long as you are aware that this will affect the speed of indexing and don´t do stuff that takes a lots of time i also think this i the best solution but i don’t think that a simple product group before a product search should take that much time.