weixin_33737134 2017-05-17 10:11 采纳率: 0%
浏览 29

带有C#的SOLR REST API

I need to index document in SOLR using SOLR rest API I am able to read data from SOLR.I am working on ASP.NET application and from client side I need to push data into SOLR any inputs regarding the same will be highly appreciated

  var pubId = '[{Message: "sdsdfsdfsfdfsddffdfd",TimeStamp: "18/5/2017 14:52:51",MessageId: "dsdsdd",id: "141ddd11d52151",User: "DEMOUser"}]';
                    $.ajax({
                        crossDomain: true,
                        type: "POST",
                       url: "http://1.1.1.1:8984/solr/core1/update?commit=true&boost=1.0&commitWithin=1000&overwrite=true&wt=json",

                       data: JSON.stringify(pubId),
                       contentType: "application/json; charset=utf-8",

                        dataType: "jsonp",
                        jsonp: 'json.wrf',
                        jsonpCallback: 'callback',
                        success: function (response) {

                            if (1 < 2) {
                                $('#txtmessage').val("");
                                var currentdate = new Date();
                                var datetime = currentdate.getDate() + "/"
                                            + (currentdate.getMonth() + 1) + "/"
                                            + currentdate.getFullYear() + " @ "
                                            + currentdate.getHours() + ":"
                                            + currentdate.getMinutes() + ":"
                                            + currentdate.getSeconds();
                                //$("#messagesend").append('<li class="left clearfix"></div><span class="chat-img1 pull-left"><span class="glyphicon glyphicon-user"></span></span>' + user + '<p>' + response + '</p><div class="chat_time pull-right">' + param2 + '</div></div></li>')
                            }
                            else {

                            }
                        },
                        failure: function (response) {

                            alert(response.responseText);
                        },
                        error: function (response) {

                            alert(response.responseText);
                        }
                    });

Question Updated I don't get any error the service response is fine but when i check in SOLR there is no new data index.enter image description here]1

I have enabled the cross-origin

<filter>
    <filter-name>cross-origin</filter-name>
    <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
    <init-param>
         <param-name>allowedOrigins</param-name>
         <param-value>http://localhost*</param-value>
    </init-param>
     <init-param>
         <param-name>allowedMethods</param-name>
         <param-value>GET,POST,DELETE,PUT,HEAD,OPTIONS</param-value>
     </init-param>
     <init-param>
         <param-name>allowedHeaders</param-name>
         <param-value>origin, content-type, cache-control, accept, options, authorization, x-requested-with</param-value>
     </init-param>
    <init-param>
        <param-name>supportsCredentials</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>chainPreflight</param-name>
      <param-value>false</param-value>
    </init-param>
</filter>

<filter-mapping>
  <filter-name>cross-origin</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

Service response Client-side

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器