You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by amit <am...@gmail.com> on 2012/11/01 12:13:57 UTC
index solr using jquery AJAX
Is is possible to index (add/update) solr using jquery AJAX?
I am trying with jasonp first, but no luck.
try {
$.ajax({
type: "POST",
url:
"http://192.168.10.113:8080/solr/update/json?commit=true",
data: { "add": { "doc": { "id": "222222", "name": "Ruby on
Trails"}} },
contentType: "application/json",
dataType: 'jsonp',
crossDomain: true,
jsonp: 'json.wrf',
success: function (data) { alert(data); },
failure: function (errMsg) {
alert(errMsg);
}
});
}
catch (err) {
alert(err);
}
Xml update is not working because the solr server is a different domain. I
have tried to use CORS filter on tomcat but that's also not working.
http://software.dzhuvinov.com/cors-filter-installation.html
Please suggest.
--
View this message in context: http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: index solr using jquery AJAX
Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello,
In that case try again with a JSON array and check if:
1. The request arrives to Solr server. In that case, copy&paste the log
traces here.
2. The request is never executed. Analyze with Firebug in your browser.
Regards,
Luis Cappa.
2012/11/2 amit <am...@gmail.com>
> Hi Luis
> Yes "solr.JsonUpdateRequestHandler" is configured in solrconfig.
> If I try with json array without jsonp, I get the Cross Origin Error.
> My solr server is in a different domain.
>
> Thanks
> Amit
>
> On Fri, Nov 2, 2012 at 8:59 PM, Rakudten [via Lucene] <
> ml-node+s472066n4017849h67@n3.nabble.com> wrote:
>
> > Hello,
> >
> > Check if you have "solr.JsonUpdateRequestHandler" configured in your
> > solrconfig.xml file. Tried again with a JSON array and without any jsonp
> > reference (dataType, crossDomain, jsonp).
> >
> > Good luck!
> >
> > Regards,
> >
> > Luis Cappa.
> >
> > 2012/11/2 amit <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=4017849&i=0>>
> >
> >
> > > I am using solr 3.6 version.
> > >
> > > Thanks
> > > Amit
> > >
> > > On Fri, Nov 2, 2012 at 7:47 PM, Rakudten [via Lucene] <
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=4017849&i=1>>
> > wrote:
> > >
> > > > Hello,
> > > >
> > > > Are you using Solr 4.0 version? If you are using the last Solr 4.0
> > > version
> > > > the endpoint url appears to be bad formed. Try with:
> > > >
> > > > http://192.168.10.113:8080/solr/update?commit=true<
> > > > http://192.168.10.113:8080/solr/update/json?commit=true>
> > > >
> > > >
> > > > Regards,
> > > >
> > > > Luis Cappa.
> > > >
> > > >
> > > > 2012/11/2 amit <[hidden email]<
> > > http://user/SendEmail.jtp?type=node&node=4017835&i=0>>
> > > >
> > > >
> > > > > Hi Luis
> > > > > I tried sending an array too, but no luck
> > > > > This is how the request looks like.
> > > > > $.ajax({
> > > > > url: "
> > http://192.168.10.113:8080/solr/update/json?commit=true
> > > ",
> > > > > type: "POST",
> > > > > contentType: "application/json; charset=utf-8",
> > > > > data: [ { "id": "222222", "name": "Seattle seahawks"} ],
> > > > > dataType: 'jsonp',
> > > > > crossDomain: true,
> > > > > jsonp: 'json.wrf'
> > > > > });
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017822.html
> > > >
> > > > > Sent from the Solr - User mailing list archive at Nabble.com.
> > > > >
> > > >
> > > >
> > > > ------------------------------
> > > > If you reply to this email, your message will be added to the
> > discussion
> > > > below:
> > > >
> > > >
> > >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017835.html
> > > > To unsubscribe from index solr using jquery AJAX, click here<
> > >
> > >
> > > > .
> > > > NAML<
> > >
> >
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017846.html
> >
> > > Sent from the Solr - User mailing list archive at Nabble.com.
> > >
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017849.html
> > To unsubscribe from index solr using jquery AJAX, click here<
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4017490&code=YW1pdC5tYWxsaWtAZ21haWwuY29tfDQwMTc0OTB8LTk5Njc5OTA3NA==
> >
> > .
> > NAML<
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017851.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
Re: index solr using jquery AJAX
Posted by amit <am...@gmail.com>.
Hi Luis
Yes "solr.JsonUpdateRequestHandler" is configured in solrconfig.
If I try with json array without jsonp, I get the Cross Origin Error.
My solr server is in a different domain.
Thanks
Amit
On Fri, Nov 2, 2012 at 8:59 PM, Rakudten [via Lucene] <
ml-node+s472066n4017849h67@n3.nabble.com> wrote:
> Hello,
>
> Check if you have "solr.JsonUpdateRequestHandler" configured in your
> solrconfig.xml file. Tried again with a JSON array and without any jsonp
> reference (dataType, crossDomain, jsonp).
>
> Good luck!
>
> Regards,
>
> Luis Cappa.
>
> 2012/11/2 amit <[hidden email]<http://user/SendEmail.jtp?type=node&node=4017849&i=0>>
>
>
> > I am using solr 3.6 version.
> >
> > Thanks
> > Amit
> >
> > On Fri, Nov 2, 2012 at 7:47 PM, Rakudten [via Lucene] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4017849&i=1>>
> wrote:
> >
> > > Hello,
> > >
> > > Are you using Solr 4.0 version? If you are using the last Solr 4.0
> > version
> > > the endpoint url appears to be bad formed. Try with:
> > >
> > > http://192.168.10.113:8080/solr/update?commit=true<
> > > http://192.168.10.113:8080/solr/update/json?commit=true>
> > >
> > >
> > > Regards,
> > >
> > > Luis Cappa.
> > >
> > >
> > > 2012/11/2 amit <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=4017835&i=0>>
> > >
> > >
> > > > Hi Luis
> > > > I tried sending an array too, but no luck
> > > > This is how the request looks like.
> > > > $.ajax({
> > > > url: "
> http://192.168.10.113:8080/solr/update/json?commit=true
> > ",
> > > > type: "POST",
> > > > contentType: "application/json; charset=utf-8",
> > > > data: [ { "id": "222222", "name": "Seattle seahawks"} ],
> > > > dataType: 'jsonp',
> > > > crossDomain: true,
> > > > jsonp: 'json.wrf'
> > > > });
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017822.html
> > >
> > > > Sent from the Solr - User mailing list archive at Nabble.com.
> > > >
> > >
> > >
> > > ------------------------------
> > > If you reply to this email, your message will be added to the
> discussion
> > > below:
> > >
> > >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017835.html
> > > To unsubscribe from index solr using jquery AJAX, click here<
> >
> >
> > > .
> > > NAML<
> >
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>
> > >
> > >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017846.html
>
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017849.html
> To unsubscribe from index solr using jquery AJAX, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4017490&code=YW1pdC5tYWxsaWtAZ21haWwuY29tfDQwMTc0OTB8LTk5Njc5OTA3NA==>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017851.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: index solr using jquery AJAX
Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello,
Check if you have "solr.JsonUpdateRequestHandler" configured in your
solrconfig.xml file. Tried again with a JSON array and without any jsonp
reference (dataType, crossDomain, jsonp).
Good luck!
Regards,
Luis Cappa.
2012/11/2 amit <am...@gmail.com>
> I am using solr 3.6 version.
>
> Thanks
> Amit
>
> On Fri, Nov 2, 2012 at 7:47 PM, Rakudten [via Lucene] <
> ml-node+s472066n4017835h33@n3.nabble.com> wrote:
>
> > Hello,
> >
> > Are you using Solr 4.0 version? If you are using the last Solr 4.0
> version
> > the endpoint url appears to be bad formed. Try with:
> >
> > http://192.168.10.113:8080/solr/update?commit=true<
> > http://192.168.10.113:8080/solr/update/json?commit=true>
> >
> >
> > Regards,
> >
> > Luis Cappa.
> >
> >
> > 2012/11/2 amit <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=4017835&i=0>>
> >
> >
> > > Hi Luis
> > > I tried sending an array too, but no luck
> > > This is how the request looks like.
> > > $.ajax({
> > > url: "http://192.168.10.113:8080/solr/update/json?commit=true
> ",
> > > type: "POST",
> > > contentType: "application/json; charset=utf-8",
> > > data: [ { "id": "222222", "name": "Seattle seahawks"} ],
> > > dataType: 'jsonp',
> > > crossDomain: true,
> > > jsonp: 'json.wrf'
> > > });
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017822.html
> >
> > > Sent from the Solr - User mailing list archive at Nabble.com.
> > >
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017835.html
> > To unsubscribe from index solr using jquery AJAX, click here<
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4017490&code=YW1pdC5tYWxsaWtAZ21haWwuY29tfDQwMTc0OTB8LTk5Njc5OTA3NA==
> >
> > .
> > NAML<
> http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017846.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
Re: index solr using jquery AJAX
Posted by amit <am...@gmail.com>.
I am using solr 3.6 version.
Thanks
Amit
On Fri, Nov 2, 2012 at 7:47 PM, Rakudten [via Lucene] <
ml-node+s472066n4017835h33@n3.nabble.com> wrote:
> Hello,
>
> Are you using Solr 4.0 version? If you are using the last Solr 4.0 version
> the endpoint url appears to be bad formed. Try with:
>
> http://192.168.10.113:8080/solr/update?commit=true<
> http://192.168.10.113:8080/solr/update/json?commit=true>
>
>
> Regards,
>
> Luis Cappa.
>
>
> 2012/11/2 amit <[hidden email]<http://user/SendEmail.jtp?type=node&node=4017835&i=0>>
>
>
> > Hi Luis
> > I tried sending an array too, but no luck
> > This is how the request looks like.
> > $.ajax({
> > url: "http://192.168.10.113:8080/solr/update/json?commit=true",
> > type: "POST",
> > contentType: "application/json; charset=utf-8",
> > data: [ { "id": "222222", "name": "Seattle seahawks"} ],
> > dataType: 'jsonp',
> > crossDomain: true,
> > jsonp: 'json.wrf'
> > });
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017822.html
>
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017835.html
> To unsubscribe from index solr using jquery AJAX, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4017490&code=YW1pdC5tYWxsaWtAZ21haWwuY29tfDQwMTc0OTB8LTk5Njc5OTA3NA==>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017846.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: index solr using jquery AJAX
Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello,
Are you using Solr 4.0 version? If you are using the last Solr 4.0 version
the endpoint url appears to be bad formed. Try with:
http://192.168.10.113:8080/solr/update?commit=true<http://192.168.10.113:8080/solr/update/json?commit=true>
Regards,
Luis Cappa.
2012/11/2 amit <am...@gmail.com>
> Hi Luis
> I tried sending an array too, but no luck
> This is how the request looks like.
> $.ajax({
> url: "http://192.168.10.113:8080/solr/update/json?commit=true",
> type: "POST",
> contentType: "application/json; charset=utf-8",
> data: [ { "id": "222222", "name": "Seattle seahawks"} ],
> dataType: 'jsonp',
> crossDomain: true,
> jsonp: 'json.wrf'
> });
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017822.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
Re: index solr using jquery AJAX
Posted by amit <am...@gmail.com>.
Hi Luis
I tried sending an array too, but no luck
This is how the request looks like.
$.ajax({
url: "http://192.168.10.113:8080/solr/update/json?commit=true",
type: "POST",
contentType: "application/json; charset=utf-8",
data: [ { "id": "222222", "name": "Seattle seahawks"} ],
dataType: 'jsonp',
crossDomain: true,
jsonp: 'json.wrf'
});
--
View this message in context: http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490p4017822.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: index solr using jquery AJAX
Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello, Amit.
Yes, it´s posible. Try to put your data in a JSON Array, not just a single
JSON Object, even if you are indexing just a single JSON - That´s the trick.
Hope it helps!
Regards,
Luis Cappa.
2012/11/1 amit <am...@gmail.com>
> Is is possible to index (add/update) solr using jquery AJAX?
> I am trying with jasonp first, but no luck.
> try {
> $.ajax({
> type: "POST",
> url:
> "http://192.168.10.113:8080/solr/update/json?commit=true",
> data: { "add": { "doc": { "id": "222222", "name": "Ruby on
> Trails"}} },
> contentType: "application/json",
> dataType: 'jsonp',
> crossDomain: true,
> jsonp: 'json.wrf',
> success: function (data) { alert(data); },
> failure: function (errMsg) {
> alert(errMsg);
> }
> });
> }
> catch (err) {
> alert(err);
> }
>
> Xml update is not working because the solr server is a different domain. I
> have tried to use CORS filter on tomcat but that's also not working.
> http://software.dzhuvinov.com/cors-filter-installation.html
>
> Please suggest.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/index-solr-using-jquery-AJAX-tp4017490.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>