English 中文(简体)
推特api-搜索太复杂了?
原标题:Twitter api - search too complex?

知道推特为什么会抛出这个错误吗?

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 characters, 23 OR clauses
  • q2: FAILED: 493 characters, 39 OR clauses
  • q3: OK: 203 characters, 17 OR clauses

因此,它可能是492个以上的字符,也可能是24个以上的子句。我怀疑是某种组合。

我没有花更多的时间进一步缩小范围,就好像指导方针已经确定,推特就会发布它们一样。我将把我的查询分成300个字符或20个子句,以先到的为准,并希望这是合理的未来证明。

更新:https://dev.twitter.com/docs/using-search他们建议将查询限制为10个子句。显然,从我上面的结果来看,这不是目前的硬性限制,但10应该是我追求的未来证明限制。

附言:回到实际问题,我注意到你的查询中有一个“&;&;”拼写错误。不知道这是否会引发投诉?(未经测试的想法)

2018年2月8日:

  1. Twitter search limites to 50 OR clauses (Notice 50 OR clauses contains 49 OR because for example word1 OR word2 contains two clauses and one OR).
  2. Twitter search limites to 500 characters.

我对OR子句的测试是:

  • 此搜索适用于:<code>h1或h2或h3或h4或h5或h6或h7或h8或h9或h10或h11或h12或h13或h14或h15或h17或h18或h19或h20或h21或h22或h23或h24或h25或h26或h27或h28或h29或h30或h31或h32或h33或h34或h35或h36或h37或h36、h37或h39或h40或h41或h42或h43或h44或h45或h46或h47或h48或h49或h50

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

我对字符数的测试是:

  • 此搜索有效(500个字符):<code>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或hell31或hell32或hell33或hell34或hell35或hell36或hell37或hell38或hell39或hell40或hell41或hell42或hell43或hell44或hell45或hell46或hell47或hell48或hell49或hell50abcdefghijklm

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

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





相关问题
Search field with Thickbox issue

i have a search form which is shown with Thickbox inside an iframe. the problem is.. that after i click "search" the result page is shown inside the same iframe! and i want it to be shown in the main ...

Will an incomplete google sitemap hurt my search ranking?

If I submit a sitemap.xml which does not contain all of the pages of my site, will this affect my search ranking? For example: If my sitemap only contained pages that had been created in the last ...

speeding up windows file search with C#

i made a program that search logical drives to find a specific file .if user type file name an click search button , searching begins , but i don t know how to stop searching in the middle of process....

JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

Embed Google/ Yahoo search into a web site or build your own

I am looking for an opinion on the whether to use Google custom search, Yahoo search builder or build my own for web projects (no more than 100 pages of content). If I should build my own - do you ...

热门标签