This is quite reasonable, because for now our search results are not any compact. I have created a ticket
. As for the code, it will mean adding a GROUP BY in the query and also a more complex cycle among rows remembering current category and comparing to previous one. I move this topic to archive now, as in progress.