[Developers] image_thumb vs. /common/topic/image query

Bryan Culbertson bryan at metaweb.com
Fri Jun 26 19:19:08 UTC 2009


Freebase.com returns the first image by index and then by first added  
to the topic. The mql query is:
{
   "id": <topic-id>,
   "/common/topic/image" : [{
     "id" : null,
     "type": "/common/image",
     "limit" : 1,
     "timestamp": null,
     "index": null,
     "link": {
       "timestamp": null
     },
     "sort": ["index", "link.timestamp"],
     "optional": true
   }]
}

Additionally, Freebase.com returns the most recent article added by  
index or created by timestamp. The mql query is:
{
   "id": <topic-id>,
   "/common/topic/article" : [{
     "id" : null,
     "type": "/common/document",
     "limit" : 1,
     "timestamp": null,
     "index": null,
     "sort": ["-index", "-timestamp"],
     "optional": true
   }]
}

I agree with you that we should have a default sorting that doesn't  
require the developer to know the current algorithm. Even within  
freebase.com we have cases where this ordering is not followed :)

--Bryan

On Jun 26, 2009, at 11:25 AM, Alec Flett wrote:

>
> On Jun 26, 2009, at 10:35 AM, Jack Alves wrote:
>
>> How does the image_thumb service select which topic to display. It  
>> seems to return the same image that is shown in the freebase.com  
>> topic page.
>>
>
> You're right that it uses "sort": "index" to find the image. If the  
> images aren't sorted, the results of image_thumb are somewhat  
> undefined, so results may change. I'm not sure what the proper sort  
> would be, if there is no index.
>
> We could try to sort by link timestamp, but its unclear (at least to  
> me) even which direction - the latest one, or the first one? The  
> latest one gives us freshness, but the first one might be more  
> 'definitive'
>
> Personally I'd say go for "sort": "index" or
>  {...
>    "link": {"timestamp": null},
>    "index": null,
>    "sort": ["index", "-link.timestamp"]
> }
>
> this at least will be predictable.
>
> Alec
>
>
>> http://api.freebase.com/api/trans/image_thumb/en/michael_jackson
>>
>> How would I get that same image using a query? A query with limit 1  
>> returns the second image in the gallery.
>>
>>   "result": [{
>>     "/common/topic/image": [{
>>       "id": "/guid/9202a8c04000641f800000000aaabb43"
>>     }],
>>     "id": "/en/michael_jackson"
>>   }],
>>
>>
>> I get the image_thumb image if I use this,
>>
>> [{
>>      "/common/topic/image": [{
>>        "id": null,
>>        "limit":1,
>>        "index":null,
>>        "sort":"index"
>>       }],
>>       "id": "/en/michael_jackson"
>> }]
>>
>>
>> Is this reliable even if images are not explicitly ordered?
>> _______________________________________________
>> Developers mailing list
>> Developers at freebase.com
>> http://lists.freebase.com/mailman/listinfo/developers
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list