Hide out of stock only on Shopify Collections

Is there anyway to hide out of stock products ONLY on collection pages? while still showing on search results?

I know we can define collections in Shopify with only in stock filter, but we have tons of collections and somme use multiple conditions so we cannot do it via the Shopify conditions.