Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search Twitter api-搜索太复杂?_Search_Twitter - Fatal编程技术网

Search Twitter api-搜索太复杂?

Search Twitter api-搜索太复杂?,search,twitter,Search,Twitter,知道Twitter为什么会抛出这个错误吗 GET https://search.twitter.com/search.json?q=Middle%20Tennessee%20State%20Blue%20Raiders%20Florida%20International%20Golden%20Panthers%20win%20OR%20lose%20-rt%20-from%3Aespn&&lang=en&since=2011-02-09: 403: Sorry, your

知道Twitter为什么会抛出这个错误吗

GET https://search.twitter.com/search.json?q=Middle%20Tennessee%20State%20Blue%20Raiders%20Florida%20International%20Golden%20Panthers%20win%20OR%20lose%20-rt%20-from%3Aespn&&lang=en&since=2011-02-09: 403: Sorry, your query is too complex. Please reduce complexity and try again.

读这本书。“查询限制为140个URL编码字符。”您的查询字符串为156个字符。

至少截至2011年8月,最大查询字符串长度似乎相当高。它对我来说效果很好,最大长度为300;当我移动到500个字符时,我得到了三个查询,其中第二个查询失败:

  • q1:OK:491个字符,23个或多个子句
  • 问题2:失败:493个字符,39个或子句
  • 问题3:确定:203个字符,17个或多个子句
所以,结果可能是492个以上的字符,或者可能是24个以上的子句。我怀疑是某种组合

我没有花更多的时间来进一步缩小范围,就好像这些指导原则是固定的,然后Twitter会发布它们一样。我将把我的查询分成300个字符或20个子句,以先到者为准,希望这是合理的未来证明

更新:在上的“最佳实践”下,他们建议将查询限制为10个子句。显然,从我上面的结果来看,这不是当前的硬限制,但10应该是我所追求的未来证明限制

另外,回到实际问题,我注意到您的查询中有一个“&&”输入错误。不知道这是否会引发投诉?(未经测试的想法)

2018年2月8日:

  • 推特搜索限制为50
    子句(注意50或子句包含49
    ,因为例如
    word1或word2
    包含两个子句和一个
  • 推特搜索限制为500个字符
  • 我对OR条款的测试是:

    • 此搜索有效:
      h1或h2或h3或h4或h5或h6或h7或h8或h9或h10或h11或h12或h13或h14或h15或h16或h17或h18或h19或h20或h21或h22或h23或h25或h26或h27或h28或h30或h31或h32或h34或h35或h36或h37或h39或h40或h41或h42或h43或h44或h46或h47或h48或h49或h50

    • 但是,如果我们添加:
      或h51
      ,它将失败

    我对字符数的测试是:

    • 此搜索有效(500个字符):
      hell1或hell2或hell3或hell4或hell5或hell6或hell7或hell8或hell9或hell10或hell11或hell12或hell13或hell14或hell15或hell16或hell17或hell18或hell19或hell20或hell21或hell22或hell23或hell24或hell25或hell26或hell27或hell28或hell29或hell30或hell32或hell33或hell35或hell36或hell37或hell38或hell39或hell40或hell41或hell42或hell43或hell44或hell45或hell46或hell47或hell48或hell49或hell50abcdefghijklm

    • 但是,如果我们将n(501个字符)添加到最后一个单词(
      hell50abcdefghijklmn
      ),它将失败


    请注意,我刚刚意识到,如果我们将字符
    o
    删除到单词
    hello
    ,结果是
    hell
    (世界正在给我发送消息吗?xD)

    ,文档URL现在已断开。你有一个更新的URL提到搜索最大复杂度准则吗?@Darren Cook:我不确定还有没有。