8

Short answer and quick fix:
Look at the gap in the relative clause. If the gap can be filled in with the pronoun it, use the relative pronoun which. If the gap can be filled in using the locative preposition there, use the relative word where:
That's the restaurant which [I hate ____ ].
That'...