News for hackers. Stuff that matters.
Re:Hacker News Search by pg on Saturday June 04, 2011 @01:03PM (#2619846)
I should add that HNSearch has an API

http://www.hnsearch.com/api

which should be a lot faster than crawling HN itself to get the same data.

Re:Hacker News Search by k7d on Saturday June 04, 2011 @02:17PM (#2620064)
So after some quick hacking I created a new HN bookmarklet based on the new API:

http://kaspa.rs/hn-bookmarklet/

If the current URL is added, it will go straight to discussion thread (without voting). If not, it will ask if you want to submit it.

Re:Hacker News Search by JoachimSchipper on Saturday June 04, 2011 @04:24PM (#2620369)
Why not model it after the submission page (submit or upvote)?
Re:Hacker News Search by k7d on Saturday June 04, 2011 @05:01PM (#2620456)
Original HN bookmarklet already works that way http://ycombinator.com/bookmarklet.html

However - I don't always want to upvote a post just because I want to check the discussion. Published this with an assumption that I'm not the only one.

Re:Hacker News Search by jrussbowman on Saturday June 04, 2011 @03:30PM (#2620255)
I'm already working on integrating the api in unscatter.com using a /hn tag - http://www.unscatter.com/search/?q=%2Fhn+facebook (currently only functional)
Re:Hacker News Search by vladocar on Saturday June 04, 2011 @02:55PM (#2620172)
I will be super cool if JSONP support is added. If we want to build web app with JavaScript it is much easier to use directly JSONP.

When I build this web app http://www.vcarrer.com/2010/11/hacker-news-mobile-front-page... I need to use Yahoo YQL to obtain JSONP.

So pretty please, add JSONP.

Re:Hacker News Search by k7d on Saturday June 04, 2011 @03:02PM (#2620195)
There is already JSONP support, see callback argument:

http://www.thriftdb.com/documentation/rest-api

Re:Hacker News Search by vladocar on Saturday June 04, 2011 @05:49PM (#2620557)
Cool! Thanks!
Re:Hacker News Search by k7d on Saturday June 04, 2011 @01:15PM (#2619885)
This is cool, but the API looks a bit cryptic. Is there a way to simply lookup an item by URL?

Edit: Nevermind, figured it out: http://api.thriftdb.com/api.hnsearch.com/items/_search?prett...

Re:Hacker News Search by news-yc on Saturday June 04, 2011 @01:24PM (#2619910)
Or, by "id"? I looked, but I wasn't able to figure out, for example, how I'd get pg's top-level comment here from the id "2619846". I was able to find it with this search, but it requires a second-part to the "_id" that I don't know where to find: http://api.thriftdb.com/api.hnsearch.com/items/_search?q=... (Trying to filter for "id" instead of "_id" throws an error, for some reason.)
Re:Hacker News Search by andres on Saturday June 04, 2011 @01:32PM (#2619933)
The `_id` attribute for each item is its submission id plus a signature. ThriftDB references objects by their unique `_id` attributes.

The `id` attribute on the other hand is an item's submission id. It's not indexed though so you can't do lookup by id.

Re:Hacker News Search by ars on Sunday June 05, 2011 @03:17AM (#2621563)
Well that explains why I failed at fetching an item by id, and I tried a whole bunch of different ways. You should really mention somewhere that the "id" referenced is an internal id, and not the HN id.

I would like to lookup items by HN id.

Re:Hacker News Search by milkshakes on Saturday June 04, 2011 @03:02PM (#2620192)
could you please index the submission ids? i can think of a few reasons this would be useful
Re:Hacker News Search by lt on Saturday June 04, 2011 @03:31PM (#2620256)
Exactly.

How do I find this comment through the API? How do I find its replies?

Re:Hacker News Search by andres on Saturday June 04, 2011 @03:25PM (#2620243)
Would you mind emailing me with your ideas? [email protected]
Re:Hacker News Search by andres on Saturday June 04, 2011 @01:39PM (#2619947)
The API docs are a work in progress. Please let me know which parts need work.
Re:Hacker News Search by k7d on Saturday June 04, 2011 @05:20PM (#2620497)
For example what's the difference between "filter[queries][]" and "q" arguments for http://www.thriftdb.com/documentation/rest-api/search-api? The way I understand, q does a simple keyword matching on all fields while "filter[queries][]" is more like SQL "where" query. In that case, what operators are supported?
Re:Hacker News Search by andres on Saturday June 04, 2011 @05:44PM (#2620545)
The `q` argument is used to perform a full-text search across all fields. One benefit to using `q` is that you can rank results based on field matches (using the `weights` argument).

The `filter` arguments are used to cut the data before performing a full-text query:

`filter[fields][fieldname]` can be used to filter on fieldnames:

http://api.thriftdb.com/api.hnsearch.com/items/_search?filte...

`filter[queries][]` can be used to add arbitrary filters:

http://api.thriftdb.com/api.hnsearch.com/items/_search?filte...

http://api.thriftdb.com/api.hnsearch.com/items/_search?filte...

The syntax for filter queries is the same as solr:

http://wiki.apache.org/solr/CommonQueryParameters#fq

Re:Hacker News Search by evanrmurphy on Saturday June 04, 2011 @06:53PM (#2620659)
Should be faster for the developer and also good for HN's servers to not have so many independent apps scraping the forum.
Re:Hacker News Search by nrbafna on Saturday June 04, 2011 @04:21PM (#2620364)
Browser notification when someone comments on your post. Would that be useful?