2

我看到以下错误:

json错误

顶部堆栈跟踪输出

代码错误位置

我的参数是

array (size=4)
  'facets' => string 'Instock.1' (length=9)
  'facetFilters' => string 'inStock.1:1' (length=11)
  'numericFilters' => string 'itemId!=511283' (length=14)
  'getRankingInfo' => int 1

如果我删除 getRankingInfo 或 numericFilters,它适用于所有请求。

根据 Algolia 中的日志,它正在返回结果,但对于某些请求,我并没有那么远。

导致错误出现的一种响应是:

要求

{
  "params": "facets=Instock.1&facetFilters=inStock.1%3A1&numericFilters=itemId%21%3D511283&getRankingInfo=1&query=WARBURTON+ORANGE+WRAPPER+800G"
}

回复

{
  "hits": [
    {
      "itemId": 506241,
      "name": "Warburton Blue Wrapper 800g",
      "slug": "506241-warburton-blue-wrapper",
      "brand": "Warburton",
      "supplier_name": "Warburtons Bread",
      "size": "800G",
      "status": "L",
      "vat_rate": "0.00",
      "popularity": 18992,
      "image": "/images/products/506241.jpg",
      "thumbnail": "/images/products/506241_thumbnail.jpg",
      "barcodes": [
        "5010044000039"
      ],
      "branches": [
        1,
        2,
        4,
        5,
        6
      ],
      "deepestCategory": "07013033337",
      "inStock": {
        "1": 1,
        "2": 0,
        "4": 1,
        "5": 1,
        "6": 1
      },
      "alternatives": [
      ],
      "objectID": "506241",
      "_highlightResult": {
        "name": {
          "value": "<em>Warburton</em> Blue <em>Wrapper</em> <em>800g</em>",
          "matchLevel": "partial",
          "matchedWords": [
            "warburton",
            "wrapper",
            "800g"
          ]
        },
        "barcodes": [
          {
            "value": "5010044000039",
            "matchLevel": "none",
            "matchedWords": [
            ]
          }
        ]
      },
      "_rankingInfo": {
        "nbTypos": 0,
        "firstMatchedWord": 0,
        "proximityDistance": 10,
        "userScore": 21542,
        "geoDistance": 0,
        "geoPrecision": 1,
        "nbExactWords": 3,
        "words": 3
      }
    },
    {
      "itemId": 511294,
      "name": "Warburton Green Wrapper ",
      "slug": "511294-warburton-green-wrapper",
      "brand": "Warburton",
      "supplier_name": "Warburtons Bread",
      "size": "",
      "status": "L",
      "vat_rate": "0.00",
      "popularity": 78098,
      "image": "/images/products/511294.jpg",
      "thumbnail": "/images/products/511294_thumbnail.jpg",
      "barcodes": [
        "5010044002347"
      ],
      "branches": [
        1,
        2,
        4,
        5,
        6
      ],
      "deepestCategory": "07013033337",
      "inStock": {
        "1":

一个工作正常的是:

请求正文

{
  "params": "facets=Instock.1&facetFilters=inStock.1%3A1&numericFilters=itemId%21%3D558471&getRankingInfo=1&query=I+CAN%27T+BELIEVE+IT%27S+NOT+BUTTER+2KG"
}

回复

{
  "hits": [
    {
      "itemId": 581691,
      "name": "I Can't Believe Its Not Butter 500g",
      "slug": "581691-i-cant-believe-its-not-butter",
      "brand": "I Can't Believe",
      "supplier_name": "U.lever Bestfoods (chilled)",
      "size": "500G",
      "status": "L",
      "vat_rate": "0.00",
      "popularity": 36597,
      "image": "/images/products/581691.jpg",
      "thumbnail": "/images/products/581691_thumbnail.jpg",
      "barcodes": [
        "000118039904",
        "05000118039904",
        "5000241007009"
      ],
      "branches": [
        1,
        2,
        3,
        4,
        5,
        6
      ],
      "deepestCategory": "07015269103",
      "inStock": {
        "1": 1,
        "2": 1,
        "3": 1,
        "4": 1,
        "5": 1,
        "6": 1
      },
      "alternatives": [
      ],
      "objectID": "581691",
      "_highlightResult": {
        "name": {
          "value": "<em>I</em> <em>Can't</em> <em>Believe</em> <em>Its</em> <em>Not</em> <em>Butter</em> 500g",
          "matchLevel": "partial",
          "matchedWords": [
            "i",
            "can",
            "t",
            "believe",
            "it",
            "s",
            "not",
            "butter"
          ]
        },
        "barcodes": [
          {
            "value": "000118039904",
            "matchLevel": "none",
            "matchedWords": [
            ]
          },
          {
            "value": "05000118039904",
            "matchLevel": "none",
            "matchedWords": [
            ]
          },
          {
            "value": "5000241007009",
            "matchLevel": "none",
            "matchedWords": [
            ]
          }
        ]
      },
      "_rankingInfo": {
        "nbTypos": 0,
        "firstMatchedWord": 0,
        "proximityDistance": 22,
        "userScore": 15914,
        "geoDistance": 0,
        "geoPrecision": 1,
        "nbExactWords": 6,
        "words": 8
      }
    },
    {
      "itemId": 247577,
      "name": "I Can't Believe Its Not Butter 250g"
4

1 回答 1

0

结果集似乎导致 json_decode 出错。当我将 hitsPerPage 限制为 10 时,一切正常。所以这里的答案是对大集合进行分页,这很明显。

感谢所有阅读和评论的人。

于 2016-01-21T11:26:24.347 回答