Why sortby doesn't seem to work?

49 views
Skip to first unread message

Sebastian Wain

unread,
Sep 13, 2011, 9:56:08 PM9/13/11
to HNSearch
I do the following search using the HNSearch API:
http://api.thriftdb.com/api.hnsearch.com/items/_search?q=ideas&sortby=points&pretty_print=true&limit=100
but the first item has a score of 6, while there are item that have a
score < 6.

What's wrong with my query?

Thanks,
Seb

Sebastian Wain

unread,
Sep 14, 2011, 12:23:00 AM9/14/11
to HNSearch
I realized that I need to explicitly use "asc" in the sortby and also
cases where a sortby by create_ts returns a greater item first, like
in this case:

...
...
...
{
"item": {
"_id": "708024-d845c",
"cache_ts": "2011-01-04T17:42:59Z",
"create_ts": "2009-07-16T14:44:48Z",
"discussion": null,
"domain": "googleblog.blogspot.com",
"id": 708024,
"num_comments": 0,
"parent_id": null,
"parent_sigid": null,
"points": 2,
"text": null,
"title": "Submit your ideas to change the face of
broadband",
"type": "submission",
"url": "http://googleblog.blogspot.com/2009/07/submit-
your-ideas-to-change-face-of.html",
"username": "GVRV"
},
"score": 1.0
},
{
"item": {
"_id": "708023-b3678",
"cache_ts": "2011-01-04T17:42:59Z",
"create_ts": "2009-07-16T14:44:43Z",
"discussion": null,
"domain": null,
"id": 708023,
"num_comments": 5,
"parent_id": null,
"parent_sigid": null,
"points": 5,
"text": "So I've been mulling this idea for a little
bit.<p>It's based on the popularity of distributed endeavours like
Folding@Home and so forth.<p>Running a distributed effort to generate
some data I could sell is never going to fly for volunteers :P so I
was thinking of other ways to \"pay\" people for it.<p>The unique idea
I came up with was this; produce a free MMO game (probably not a 3D
game). Then instead of charging a monthly fee include our distributed
system in the game. When people are playing the game it generates some
data (designed not to hog the CPU ofc) and sends it back - this \"pays
\" for their play time.<p>The extension could be to get them to
generate data when not playing the game and this could add up to give
them \"in game\" credit for items and VIP treatment.<p>If I get the
balance right (i.e. just creating some data but not affecting their
computer use) do you think it would go down well? (obviously the game
would have to be attractive - but i have ideas :D)",
"title": "Ask HN: A gaming idea",
"type": "submission",
"url": null,
"username": "ErrantX"
},
"score": 1.0
},
...
...
...

On Sep 13, 10:56 pm, Sebastian Wain <sebastian.w...@gmail.com> wrote:
> I do the following search using the HNSearch API:http://api.thriftdb.com/api.hnsearch.com/items/_search?q=ideas&sortby...

ThriftDB

unread,
Sep 14, 2011, 1:05:32 AM9/14/11
to hnse...@googlegroups.com
Hi Seb,

Can you post the URL of the query with the sortby error?

Andres

Sebastian Wain

unread,
Sep 14, 2011, 6:59:37 AM9/14/11
to HNSearch
Hi Andres,

It's the same request as the first post in the thread:

- http://api.thriftdb.com/api.hnsearch.com/items/_search?q=ideas&sortby=points&pretty_print=true&limit=100
Doesn't sort by points

- http://api.thriftdb.com/api.hnsearch.com/items/_search?q=ideas&sortby=points%20asc&pretty_print=true&limit=100
Sorts by points because I explicitly used the asc modifier.

Thanks,
Seb

On Sep 14, 2:05 am, ThriftDB <and...@thriftdb.com> wrote:
> Hi Seb,
>
> Can you post the URL of the query with the sortby error?
>
> Andres
>

andres

unread,
Sep 14, 2011, 9:58:58 AM9/14/11
to HNSearch
Hi Seb,

I tried sorting the second url by create_ts but don't see the items
you pasted in:

http://api.thriftdb.com/api.hnsearch.com/items/_search?q=ideas&sortby=create_ts%20asc&pretty_print=true&limit=100

Let me know what I'm doing wrong.

Andres

On Sep 14, 6:59 am, Sebastian Wain <sebastian.w...@gmail.com> wrote:
> Hi Andres,
>
> It's the same request as the first post in the thread:
>
> -http://api.thriftdb.com/api.hnsearch.com/items/_search?q=ideas&sortby...
> Doesn't sort by points
>
> -http://api.thriftdb.com/api.hnsearch.com/items/_search?q=ideas&sortby...
Reply all
Reply to author
Forward
0 new messages