I found this very ancient bit of code, not sure it even works anymore, but you 
can give it a try.  The problem isn't so much sending the request (if you've 
got the original query with params, you can call Solr through a plain old HTTP 
request), but it's parsing the response that's the tedious bit without Solrj, 
so the following code unmarshals the raw (binary?) response using the 
JavaBinCodec, and then makes a QueryResponse out of the NamedList<>.

                        DefaultHttpClient httpclient = new DefaultHttpClient();
                        HttpGet get = new HttpGet(queryUrl.toURI());
                        HttpResponse response1 = httpclient.execute(get);
                        StatusLine statusLine = response1.getStatusLine();
                        HttpEntity entity = response1.getEntity();
                        InputStream content = entity.getContent();

                        //NamedList<Object> namedList = (NamedList<Object>)new 
JavaBinCodec().unmarshal(queryUrl.openConnection().getInputStream()); 
                        NamedList<Object> namedList = (NamedList<Object>)new 
JavaBinCodec().unmarshal(content); 
                        content.close();
                        
                        QueryResponse resp = new QueryResponse(namedList, null);

-----Original Message-----
From: Dickinson, Cliff [mailto:cdickin...@ncaa.org] 
Sent: Wednesday, October 15, 2014 9:37 AM
To: solr-user@lucene.apache.org
Subject: Run a query via SolrJ using Request URL

I'm faily new to Solr and have run into an issue that I cannot figure out how 
to solve.   I'm trying to implement a Save Search requirement similar to 
bookmarking to allow the same search to be run in the future.  Once the 
original search is executed from within a Spring app, I use the 
ClientUtils.toQueryString() to store a copy of the actual request URL that was 
sent to the Solr Server in a database table(if save is requested).  That part 
works great, but now I can't find anything in the SolrJ API that will allow me 
to run that query from the original URL rather than having to piece it together 
again via a SolrQuery object.  Is there anything out there to run from this URL 
or do I need to manually split it out and build the SolrQuery?

Thanks in advance for the advice!

Cliff

This email and any attachments may contain NCAA confidential and privileged 
information. If you are not the intended recipient, please notify the sender 
immediately by return email, delete this message and destroy any copies. Any 
dissemination or use of this information by a person other than the intended 
recipient is unauthorized and may be illegal.

Reply via email to