Dan, You didn't mention whether you tried &wt=json . Does it work if you use that to tell Solr to return its response in JSON format?
Otis -- Sematext -- http://sematext.com/ -- Solr - Lucene - Nutch ----- Original Message ---- > From: Dan Yamins <dyam...@gmail.com> > To: solr-user@lucene.apache.org > Sent: Sat, January 9, 2010 10:05:54 PM > Subject: Getting solr response data in a JS query > > Hi: > > I'm trying to use figure out how to get solr responses and use them in my > website. I'm having some problems figure out how to > > 1) My initial thought is is to use ajax, and insert a line like this in my > script: > > data = eval($.get("http://localhost:8983/solr/select/?q=*:* > ").responseText) > > ... and then do what I want with the data, with logic being done in > Javascript on the front page. > > However, this is just not working technically: no matter what alternative I > use, I always seem to get no response to this query. I think I'm having > exactly the same problem as described here: > > http://www.mail-archive.com/solr-user@lucene.apache.org/msg29949.html<%20http://www.mail-archive.com/solr-user@lucene.apache.org/msg29949.html> > > and here: > > http://stackoverflow.com/questions/1906498/solr-responses-to-webbrowser-url-but-not-from-javascript-code > > Just like those two OPs, I can definitely access my solr responese through a > web browser, but my jquery is getting nothing. Unfortunately, in neither > thread did the answer seem to have been figured out satisfactorily. Does > anybody know what the problem is? > > > 2) As an alternative, I _can_ use the ajax-solr library. Code like this: > > var Manager; > (function ($) { > $(function () { > Manager = new AjaxSolr.Manager({ > solrUrl: 'http://localhost:8983/solr/' > }); > > Manager.init(); > Manager.store.addByValue('q', '*:*'); > Manager.store.addByValue('rows', '1000'); > Manager.doRequest(); > }); > })(jQuery); > > does indeed load solr data into my DOM. Somehow, ajax-solr's doRequest > method is doing something that makes it possible to receive the proper > response from the solr servlet, but I don't know what it is so I can't > replicate it with my own ajax. Does anyone know what is happening? > > (Of course, I _could_ just use ajax-solr, but doing so would mean figuring > out how to re-write my existing application for how to display search > results in a form that works with the ajax-solr api, and I' d rather avoid > this if possible since it looks somewhat nontrivial.) > > > Thanks! > Dan