The following script is an example on how to build a custom query with Drupal's Apache Solr Search module.
In order to test it, you can copy the file to the root of your Drupal site, set the nid at the top, adjust the query and run it with the following Drush command:
drush scr custom_solr_query.php
You can find further details about it at this article from the Lullabot Blog.