I know this is just copy/pasta, but this should probably be made to use of url() to build the URL...  See it's "query" parameter. Also, not sure that the use of htmlspecialchars() is entirely appropriate...  There some "escaping" function in the Apache Solr library to escape special characters, if I recall correctly.