When is Tree Search Useful for LLM Planning? It Depends on the Discriminator