[Developers] Total Count Using Search API

Faye Harris faye at metaweb.com
Wed Sep 17 21:26:42 UTC 2008


Hi Kendra,

The short answer is no. There's no way to ask how many search results 
you'd get from the Search API. You can, however, calculate the length of 
the result object once you get the response. This works for queries with 
a small number of results, but for ambitious searches, the number of 
results you're likely to get is either 1) the limit of your query, 2) 
the hard-coded limit of the current search API which is 100, or 3) 
(rarely) a timeout.

BTW, the search API is undergoing some changes right now, and the 
hard-coded limit will be removed in the new search. Then, you'd be just 
up against the timeout for challenging queries.

-- Faye


Kendra Kuhl wrote:
> Thanks Phil,
>
> That works in the MqlRead API, but doesn't appear to work in the Search API.
> At least I didn't see it when I tried this search:
>
> http://www.freebase.com/api/service/search?query=paris%20france&limit=20&ret
> urn=count
>
> Kendra
>
> -----Original Message-----
> From: developers-bounces at freebase.com
> [mailto:developers-bounces at freebase.com] On Behalf Of Phil Gochenour
> Sent: Wednesday, September 17, 2008 4:08 PM
> To: For discussions about MQL, Freebase API and apps built on Freebase
> Subject: Re: [Developers] Total Count Using Search API
>
> Kendra,
>
> there are directives you can use in your query to get the number of results
> without getting the results themselves. "return":"count" will give you the
> number of results within a query, while "return":"estimate-count" will give
> you an estimated number (and it's generally faster).
>
> Phil
>
> ----- Original Message -----
> From: "Kendra Kuhl" <kendra.kuhl at juggle.com>
> To: "For discussions about MQL, Freebase API and apps built on Freebase"
> <developers at freebase.com>
> Sent: Wednesday, September 17, 2008 1:55:27 PM (GMT-0800)
> America/Los_Angeles
> Subject: [Developers] Total Count Using Search API
>
> _______________________________________________
> 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
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
>   



More information about the Developers mailing list