My favorites | Sign in
Project Logo
       
New issue | Search
for
| Advanced search | Search tips
Issue 740: search api return status code 403 instead of 404 when there is no matching tweets
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  m...@twitter.com
Closed:  Jun 24
Type-Defect
Priority-Medium
Component-Search


Sign in to add a comment
 
Reported by yus...@mac.com, Jun 23, 2009
As of June 24th 2009, the search API started to return status code:403 when there is no matching tweets. 
It used to be returning status code 404. 
----------- 
[Wed Jun 24 12:50:31 JST 2009]GET http://search.twitter.com/search.json?q=from%3Atwit4j+doesnothit 
[Wed Jun 24 12:50:31 JST 2009]X-Twitter-Client-URL: 
http://yusuke.homeip.net/twitter4j/en/twitter4j-undefined.xml 
[Wed Jun 24 12:50:31 JST 2009]Accept-Encoding: gzip 
[Wed Jun 24 12:50:31 JST 2009]User-Agent: twitter4j http://yusuke.homeip.net/twitter4j//undefined 
[Wed Jun 24 12:50:31 JST 2009]X-Twitter-Client-Version: undefined 
[Wed Jun 24 12:50:31 JST 2009]Response: 
[Wed Jun 24 12:50:31 JST 2009]HTTP/1.1 403 Forbidden 
[Wed Jun 24 12:50:31 JST 2009]Age: 0 
[Wed Jun 24 12:50:31 JST 2009]X-Served-From: searchdb014 
[Wed Jun 24 12:50:31 JST 2009]Content-Length: 53 
[Wed Jun 24 12:50:31 JST 2009]Expires: Wed, 24 Jun 2009 03:55:32 GMT 
[Wed Jun 24 12:50:31 JST 2009]X-Served-By: searchweb014.twitter.com 
[Wed Jun 24 12:50:31 JST 2009]Connection: close 
[Wed Jun 24 12:50:31 JST 2009]Server: hi 
[Wed Jun 24 12:50:31 JST 2009]X-Cache: MISS 
[Wed Jun 24 12:50:31 JST 2009]Cache-Control: max-age=60, must- 
revalidate, max-age=300 
[Wed Jun 24 12:50:31 JST 2009]Status: 403 Forbidden 
[Wed Jun 24 12:50:31 JST 2009]X-Varnish: 120647426 
[Wed Jun 24 12:50:31 JST 2009]Date: Wed, 24 Jun 2009 03:50:32 GMT 
[Wed Jun 24 12:50:31 JST 2009]Vary: Accept-Encoding 
[Wed Jun 24 12:50:31 JST 2009]Content-Encoding: gzip 
[Wed Jun 24 12:50:31 JST 2009]Via: 1.1 varnish 
[Wed Jun 24 12:50:31 JST 2009]X-Cache-Svr: searchweb014.twitter.com 
[Wed Jun 24 12:50:31 JST 2009]Content-Type: application/json; 
charset=utf-8 
[Wed Jun 24 12:50:31 JST 2009]{"error":"Exceptions::NoResults"} 
----------- 
Comment 1 by m...@twitter.com, Jun 24, 2009
This seems to depend on the combination of search operators and was therefore not caught by our tests. My 
test for a search with 0 results worked fine:

$ curl -v  'http://search.twitter.com/search.json?q=blagorama'
* About to connect() to search.twitter.com port 80 (#0)
*   Trying 128.121.146.235... connected
* Connected to search.twitter.com (128.121.146.235) port 80 (#0)
> GET /search.json?q=blagorama HTTP/1.1
> User-Agent: curl/7.19.4 (i386-apple-darwin9.6.2) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3
> Host: search.twitter.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Wed, 24 Jun 2009 14:28:59 GMT
< Server: hi
< Status: 200 OK
< X-Served-From: searchdb016
< X-Timeline-Cache-Hit: Hit
< Cache-Control: max-age=60, must-revalidate, max-age=300
< Content-Type: application/json; charset=utf-8
< X-Served-By: searchweb016.twitter.com
< Expires: Wed, 24 Jun 2009 14:33:59 GMT
< Content-Length: 171
< Vary: Accept-Encoding
< X-Varnish: 1350153762
< Age: 0
< Via: 1.1 varnish
< X-Cache-Svr: searchweb016.twitter.com
< X-Cache: MISS
< Connection: close
< 
* Closing connection #0
{"results":[],"since_id":0,"max_id":2309905681,"refresh_url":"?
since_id=2309905681&q=blagorama","results_per_page":15,"completed_in":0.021938,"page":1,"query":"blago
rama"}

Also correctly returning 0 results are searches for:

 [foo from:mzsanford]
 [from:mzsanford bar]
 [from:twit4j foo]

It would seem to be something with doesnothit (probably a word never seen). Failure cases:

 [doesnothit]
 [doesnothit from:mzsanford]

I'll look into this.
 
Status: Accepted
Owner: m...@twitter.com
Labels: Component-Search
Comment 2 by m...@twitter.com, Jun 24, 2009
Found the root cause and a fix is awaiting review.
Comment 3 by m...@twitter.com, Jun 24, 2009
Fix deployed and verified with:

curl 'http://search.twitter.com/search.json?q=from%3Atwit4j+doesnothit'
Status: Fixed
Sign in to add a comment

Hosted by Google Code