Typically, you're better off not worrying about it and just passing the user query unaltered onto solr as it is. Anything you need to do in addition to the user query (extra conditionals, etc) can be done in a separate fq paramter(s) or added automatically by the default parameters in your solr-config.xml. An accidental 'and', 'or', etc that's not escaped will not be the end of the world for the user, the results will still be reasonably correct. Additionally, your power users can actively use them to their advantage.
If you really want to protect the user from themselves then you could go down the road of full query parsing (and the dealing with syntax errors). There was a lucene query parser in the zend framework zend_search_lucene classes that you could probably dig up. You could also restrict your users to a simpler query language than full syntax and just do find / replaces. Because this can be so usage specific, I didn't really try to address this directly in the client, but I have had to do query manipulation in the past, and its never seems to turn out super pretty.
Donovan