Hello,
It would be easier to use repeater web part and set the WHERE condition to filter the documents by category. Or, another option is to modify the document library control that is used by the web part and add custom logic to filter out the documents based on their category.
For the search filter, here you can see how to use the syntax for a
search filter.
Best regards,
Juraj Ondrus