Filter Contracts by line items

Hi,
our sales team want to filter contracts by attributes of line items = products.

e.g. we want to find all contracts containing a specific product.
Or all contracts containing a specific attribute with an specific attribute set.

Is this possible?

Regards