Re: javascript form data save to XML in server side
I always, always have a web application running that accepts the JavaScript AJAX call and then forwards it on to the Apache Solr request handler. Even if you don't control the web application, and can only add JavaScript, you can put up a API oriented webapp somewhere that only protects Solr for a couple of posts. Then, you can use CORS or JSONP to facilitate interaction between the main web application and the ancillary webapp providing APIs for Solr integration. Of course, this only applies if you don't control the primary application. If you can use a Drupal or Typo3 to front-end Solr, than this is a great way to solve the problem. On Mon, Oct 20, 2014 at 11:02 PM, LongY zhangyulin8...@hotmail.com wrote: thank you very much. Alex. You reply is very informative and I really appreciate it. I hope I would be able to help others in this forum like you are in the future. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025p4165066.html Sent from the Solr - User mailing list archive at Nabble.com.
javascript form data save to XML in server side
hello list, The functionality I would like to add the the existing /browse request handler is using a user interface (e.g.,webform) to collect the user's input. My approach is add a javascript form into the velocity template, below is the code I added to the velocity template(for example): form id=myForm, action=ProcessData.php First name: input type=text name=fname value=br Last name: input type=text name=lname value=br /form And I am using this ProcessData.php to process the user input to generate a XML in the server. My question is 1) how to make solr to run this ProcessData.php? It seems solr does not support php? 2) Where is this ProcessData.php going to be placed in the solr directory? I am a newbie in web programming. I tried very hard to catch up with it. Thank you. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: javascript form data save to XML in server side
One possibility is to send to one of Solr's /update handlers from your page. It won't be straightforward unless you were POSTing a file to /update/extract, but it would be possible for a little bit of JavaScript onSubmit to format the data amenable to Solr. I've not done this myself but it'd be a cute simple example. Solr's admin UI does have a way to add docs that you might want to use as one possible example, though it's lower level than form fields like you're desiring. Erik On Oct 20, 2014, at 16:54, LongY zhangyulin8...@hotmail.com wrote: hello list, The functionality I would like to add the the existing /browse request handler is using a user interface (e.g.,webform) to collect the user's input. My approach is add a javascript form into the velocity template, below is the code I added to the velocity template(for example): form id=myForm, action=ProcessData.php First name: input type=text name=fname value=br Last name: input type=text name=lname value=br /form And I am using this ProcessData.php to process the user input to generate a XML in the server. My question is 1) how to make solr to run this ProcessData.php? It seems solr does not support php? 2) Where is this ProcessData.php going to be placed in the solr directory? I am a newbie in web programming. I tried very hard to catch up with it. Thank you. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: javascript form data save to XML in server side
There is a couple of issues with what you are saying here: 1) You should not be exposing Solr directly to the internet. They would be able to delete all your records and do other damage. /browse endpoint is there to show-off what Solr can do, not to be used in production 2) Solr is Java, it does not run PHP. You can write a custom handler in Java, but you probably don't want to start your programming career from that (too hard). Or you can run Javascript to post back to Solr, but that still requires Solr to be publicly accessible - see 1) 3) If you don't care what language you are using and just want a nice UI that's backed by Solr, you could look at Spring Boot which has Spring Data integration with Solr. 4) Or you might be looking at a content management system that integrates Solr, such as Typo3 (which is PHP) So, you need to step back and think a bit harder about what you are trying to do. Regards, Alex. Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 20 October 2014 16:54, LongY zhangyulin8...@hotmail.com wrote: hello list, The functionality I would like to add the the existing /browse request handler is using a user interface (e.g.,webform) to collect the user's input. My approach is add a javascript form into the velocity template, below is the code I added to the velocity template(for example): form id=myForm, action=ProcessData.php First name: input type=text name=fname value=br Last name: input type=text name=lname value=br /form And I am using this ProcessData.php to process the user input to generate a XML in the server. My question is 1) how to make solr to run this ProcessData.php? It seems solr does not support php? 2) Where is this ProcessData.php going to be placed in the solr directory? I am a newbie in web programming. I tried very hard to catch up with it. Thank you. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: javascript form data save to XML in server side
I guess the admin UI for adding docs you mentioned is Data Import Handler. If I understand your reply correctly, the idea is to post the javascript form data from the webpage to /update/extract handler. Thank you for shedding some light. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025p4165059.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: javascript form data save to XML in server side
In the most recent Solr, there is a Documents page, next after the DataImportHandler page. That's got several different ways to add a document. Regards, Alex. Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 20 October 2014 22:08, LongY zhangyulin8...@hotmail.com wrote: I guess the admin UI for adding docs you mentioned is Data Import Handler. If I understand your reply correctly, the idea is to post the javascript form data from the webpage to /update/extract handler. Thank you for shedding some light. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025p4165059.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: javascript form data save to XML in server side
The solr users are trustworthy and it's only for internal use. The purpose of this form is to allow user to directly input data to be further indexed by solr. I am interested in this sentence from your reply which is Or you can run Javascript to post back to Solr. Please bear with me if I ask very simple question on the web programming. From my understanding, javascript is client-side programming language, how is it possible to post the form data back to Solr using javascript. Thank you. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025p4165061.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: javascript form data save to XML in server side
Most of the javascript frameworks (AngularJS, etc) allow to post information back to the server. If you use gmail or yahoo mail or anything else, it's a javascript that lets you send a message. So, if you completely trust your users, you can just have Javascript and Solr and nothing else. Though I would then make sure that Solr has all the fields as stored. Otherwise, if you ever need to reindex, you will have not be able to retrieve index-only fields. Usually that's not an issue as the Solr is NOT the primary storage (database is), but you seem to want to make Solr the primary storage, so you have additional issues to keep in mind.f Regards, Alex. Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 20 October 2014 22:22, LongY zhangyulin8...@hotmail.com wrote: The solr users are trustworthy and it's only for internal use. The purpose of this form is to allow user to directly input data to be further indexed by solr. I am interested in this sentence from your reply which is Or you can run Javascript to post back to Solr. Please bear with me if I ask very simple question on the web programming. From my understanding, javascript is client-side programming language, how is it possible to post the form data back to Solr using javascript. Thank you. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025p4165061.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: javascript form data save to XML in server side
thank you very much. Alex. You reply is very informative and I really appreciate it. I hope I would be able to help others in this forum like you are in the future. -- View this message in context: http://lucene.472066.n3.nabble.com/javascript-form-data-save-to-XML-in-server-side-tp4165025p4165066.html Sent from the Solr - User mailing list archive at Nabble.com.