json decode error on some requests but not others with Algolia php library -
i'm seeing following error:
my params are
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
if remove either getrankinginfo or numericfilters, works requests.
according logs in algolia it's returning results, don't far on end requests.
one response causes error appear is:
request
{ "params": "facets=instock.1&facetfilters=instock.1%3a1&numericfilters=itemid%21%3d511283&getrankinginfo=1&query=warburton+orange+wrapper+800g" }
response
{ "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":
one works fine is:
request body
{ "params": "facets=instock.1&facetfilters=instock.1%3a1&numericfilters=itemid%21%3d558471&getrankinginfo=1&query=i+can%27t+believe+it%27s+not+butter+2kg" }
response
{ "hits": [ { "itemid": 581691, "name": "i can't believe 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 not butter 250g"
it seems result set causing error json_decode. when limited hitsperpage 10 works fine. answer here paginate large sets, obvious really.
thanks read , commented.
Comments
Post a Comment