开发者

How to check that solr server is running

开发者 https://www.devze.com 2023-03-22 05:04 出处:网络
i have implemented search in my E commerceapplication. which hit solr(running on port 8983) 开发者_JS百科to get the search result

i have implemented search in my E commerce application. which hit solr(running on port 8983) 开发者_JS百科to get the search result

solr url is

url =solrURL+"/solr/db/select/?qt=dismax&wt=json&&start="+start+"&rows="+end+"&q="+lowerCaseQuery+"&hl=true&hl.fl=text&hl.usePhraseHighlighter=true&sort= score desc ,"+sort+" "+order+"&json.wrf=?"

and using getJson i am getting the solr response.

 $.getJSON(url, function(result){

now my problem is how can i determine that solr server is running.

EDIT:

$

.ajax({
                url: "http://192.168.1.9:8983/solr/db/admin/ping",
                    success:function(){
                            alert("ok");
                        },
                        error: function()
                        {
                            alert("dsd");                       
                        }
            })      


You need to specify a timeout value. Though getJSON does not specify one you may use the jquery method $.ajax see: http://api.jquery.com/jQuery.ajax/

$.ajax({
  url: url,
  dataType: 'json',
  data: data,
  success: callback,
  timeout: 3000 //3 second timeout
});

For the ping you may check the following snippet:

$.ajax({
  url: 'http://192.168.1.9:8983/solr/db/admin/ping',
  type: 'GET',
  complete: function(transport) {
     if(transport.status == 200) {
         alert('Success');
     } else {
         alert('Failed');
     }
  }
 });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号