Hi 

I am trying to post JSON Data to Solr using XHR / JQuery and it doesn't seem
to work. I don't get any exception on the jetty console. Has anyone tried
this before and are their any obvious gotchas in my code. 

Here is my code snippet

$(document).ready(function(){
var url='http://localhost:8983/solr/update?commit=true';
var name = $("#name").val();
    $('button').click(function(){
        // Assign handlers immediately after making the request,
        // and remember the jqxhr object for this request
        alert("Button Clicked");
        var jqxhr = $.post(url, { "id" : "978-0545139700",
            "cat" : "book",
            "name" : "Harry Potter and the Deathly Hallows",
            "author" : "J K Rowling",
            "price" : "13.65",
            "pages_i" : "787"            
        },
        function(data) {
            alert("Data Loaded: " + data); // I don't get this alert
          });
        // perform other work here ...

        // Set another completion function for the request above
        jqxhr.complete(function(){ alert("second complete"); }); // I get
this alert
    

Here is the message on the console. 


2012-05-16 21:50:21.457:DBUG:oejs.ServletHandler:servlet /solr|/update|null
-> default
2012-05-16
21:50:21.457:DBUG:oejs.ServletHandler:chain=SolrRequestFilter->default
2012-05-16 21:50:21.457:DBUG:oejs.ServletHandler:call filter
SolrRequestFilter
May 16, 2012 9:50:21 PM org.apache.solr.update.DirectUpdateHandler2 commit
INFO: start
commit{flags=0,version=0,optimize=false,openSearcher=true,waitSearcher=true,expungeDeletes=false,softCommit=false}
May 16, 2012 9:50:21 PM org.apache.solr.search.SolrIndexSearcher <init>
INFO: Opening Searcher@56101751 main
May 16, 2012 9:50:21 PM org.apache.solr.update.DirectUpdateHandler2 commit
INFO: end_commit_flush
May 16, 2012 9:50:21 PM org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener sending requests to Searcher@56101751
main{StandardDirectoryReader(segments_c:31 _0(4.0):Cv32 _1(4.0):C2
_3(4.0):C4)}
May 16, 2012 9:50:21 PM org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener done.
May 16, 2012 9:50:21 PM org.apache.solr.core.SolrCore registerSearcher
INFO: [collection1] Registered new searcher Searcher@56101751
main{StandardDirectoryReader(segments_c:31 _0(4.0):Cv32 _1(4.0):C2
_3(4.0):C4)}
May 16, 2012 9:50:21 PM org.apache.solr.update.processor.LogUpdateProcessor
finish
*INFO: [collection1] webapp=/solr path=/update
params={id=978-0545139700&author=J+K+Rowling&cat=book&price=13.65&pages_i=787&commit=true&name=Harry+Potter+and+the+Deathly+Hallows}
{commit=} 0 29
**2012-05-16 21:50:21.488:DBUG:oejs.Server:RESPONSE /solr/update  200*
2012-05-16 21:51:11.488:DBUG:oejh.HttpParser:filled -1/0
2012-05-16 21:51:11.489:DBUG:oejs.AbstractHttpConnection:closed
BlockingHttpConnection@627e9505,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=0,l=0,c=-3},r=1



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Posting-JSON-Data-to-Solr-using-XHR-tp3984309.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to