I have 5000 products in my shop and the front page has only a search bar. A user types just the color of the product he wants and all the products have custom attributes with their color. Products belong to multiple categories for example t-shirt,jeans,etc.. All i want is when the search is finished in the result page to display the categories of the products and not the products for example if i type "red" to show me only the categories who have products with the red attribute and then when i click on the category to see those products. I have made the search to work with the custom attributes but in the result page i see the products and not the categories they belong.
In the image you can see the arrows shows the category each products belongs. All i want is to show the two different categories instead of the products and then click on each category to see the products that matched my search