如何获得拼写检查器的响应json solr。

URL==>> http:/localhost:8080solrTestsuggest?indent=true&wt=json&q=how。

{
  "responseHeader":{
    "status":0,
    "QTime":2},
  "spellcheck":{
    "suggestions":[
      "how",{
        "numFound":5,
        "startOffset":0,
        "endOffset":3,
        "suggestion":["how to tie a tie",
          "how to get away with a murderer",
          "how to boil eggs",
          "how to lose weight",
          "how to make money"]}]}}

我得到的是上面的json格式,如何用jquery获取这个响应?

解决方案:

I got my answer, I was looking this solution
 $.ajax({ url: "http://localhost:8080/solr/Test/suggest",
          dataType: "json",
          success: function( data ) {
          var suggestions = (data.spellcheck.suggestions && 
           data.spellcheck.suggestions.length > 1) ? 
           data.spellcheck.suggestions[1].suggestion : [];
            for (var d=0; d < suggestions.length; d++) {
               var doc = suggestions[d];
       }

所有的建议值都在doc变量中

给TA打赏
共{{data.count}}人
人已打赏
未分类

Devise Token Auth确认邮件链接已过期

2022-9-8 19:48:40

未分类

Python中的返回问题

2022-9-8 19:48:42

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索