Hide certain blocks or blocks and their children from search results

For example I wanted to add a large code block, but it uses a specific term like bananas many times in it. I don’t want it to be in the top results when I search for bananas, because instead I only want it’s parent block to be visible in the search results (which I have in this case specifically put in it’s content the keyword bananas.