Thanks Erick, Your blog post made it clear. It was looong, but not too long.
Roland 2015-08-29 19:00 GMT+02:00 Erick Erickson <erickerick...@gmail.com>: > 1> My first guess is that your autocommit > section in solrconfig.xml has <openSearcher>false</openSearcher> > So the commitWithin happened but a new searcher > was not opened thus the document is invisible. > Try issuing a separate commit or change that value > in solrconfig.xml and try again. > > Here's a loooong post on all this: > > https://lucidworks.com/blog/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/ > > 2> No clue since I'm pretty ajax-ignorant. > > 3> because curl easily downloadable at worst and most often > already on someone's machine and let people at least get started. > Pretty soon, though, for production situations people will use SolrJ > or the like or use one of the off-the-shelf tools packaged around > Solr. > > Best > Erick > > On Sat, Aug 29, 2015 at 9:30 AM, Szűcs Roland > <szucs.rol...@bookandwalk.hu> wrote: > > Hello SOLR experts, > > > > I am new to solr as you will see from my problem. I just try to > understand > > how solr works. I use one core (BandW) on my locla machine and I use > > javascript for my learning purpose. > > > > I have a test schema.xml: with two fileds: id, title. I managed to run > > queries with faceting, autocomplete, etc. In all cases I used Ajax post > > method. For example my search was (searchWithSuggest.searchAjaxRequest is > > an XMLHttpRequest object): > > var s=document.getElementById(searchWithSuggest.inputBoxId).value; > > var params='q='+s+'&start=0&rows=10'; > > a=searchWithSuggest.solrServer+'/query'; > > searchWithSuggest.searchAjaxRequest.open("POST",a, true); > > searchWithSuggest.searchAjaxRequest.setRequestHeader("Content-type", > > "application/x-www-form-urlencoded"); > > searchWithSuggest.searchAjaxRequest.send(encodeURIComponent(params)); > > > > It worked fine. I thought that an xml update can work the same way so I > > tried to add and index one new document by xml(a is an XMLHttpRequest > > object): > > a.open("POST","http://localhost:8983/solr/bandw/update",true); > > a.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); > > a.send(encodeURIComponent("stream.body=<add commitWithin=5000><doc><field > > name='id'>3222</field><field name='title'>Blade</field></doc></add>")); > > > > I got a response with error: missing content stream. > > > > I have changed only the a.open function call to this one: > > a.open("POST","http://localhost:8983/solr/bandw/update?commit=true > ",true); > > the rest of the did not change. > > Finally, I got response with no error from SOLR. Later it turned out that > > the new doc was not indexed at all. > > > > My questions: > > 1. If I get no error from solr what is wrong with the second solution and > > how can I fix it? > > 2. Is there any solution to put all the parameters to the a.send call as > in > > case of queries. I tried > > a.send(encodeURIComponent("commit=true&stream.body=<add > > commitWithin=5000><doc><field name='id'>3222</field><field > > name='title'>Blade</field></doc></add>")); but it was not working. > > 3. Why 95% of the examples in SOLR wiki pages relates to curl. Is this > the > > most efficient alternative? Is there a "mapping" between a curl syntax > and > > the post request? > > > > Best Regards, > > Roland > > > > -- > > <https://www.linkedin.com/pub/roland-sz%C5%B1cs/28/226/24/hu>Szűcs > Roland > > <https://www.linkedin.com/pub/roland-sz%C5%B1cs/28/226/24/hu > >Ismerkedjünk > > meg a Linkedin < > https://www.linkedin.com/pub/roland-sz%C5%B1cs/28/226/24/hu> > > -en <https://bookandwalk.hu/>ÜgyvezetőTelefon: +36 1 210 81 > 13Bookandwalk.hu > > <https://bokandwalk.hu/> > -- <https://www.linkedin.com/pub/roland-sz%C5%B1cs/28/226/24/hu>Szűcs Roland <https://www.linkedin.com/pub/roland-sz%C5%B1cs/28/226/24/hu>Ismerkedjünk meg a Linkedin <https://www.linkedin.com/pub/roland-sz%C5%B1cs/28/226/24/hu> -en <https://bookandwalk.hu/>ÜgyvezetőTelefon: +36 1 210 81 13Bookandwalk.hu <https://bokandwalk.hu/>