Search

The Search API provides access to Freebase data given a free text query. Please consult Search Overview and the Search Cookbook for more information on how to construct detailed search queries.

Request

HTTP request

GET https://www.googleapis.com/freebase/v1/search

Parameters

All parameters below are optional but you must have one of either query or filter.

Parameter name Value Description
Optional parameters
as_of_time string A MQL as_of_time value to use with mql_output queries.
callback string JS method name for JSONP callbacks.
cursor integer The cursor parameter along with the limit parameter allows you to page through a defined number of results at a time. For example, to present 3 pages of successive 10 results, use  limit=10 and cursor=0, then cursor=10, and cursor=20.
domain string Restrict to topics with this Freebase domain ID.
encode string The encoding of the response. You can use this parameter to enable HTML encoding.

Acceptable values are:
  • "html": Encode certain characters in the response (such as tags and ampersands) using HTML encoding.
  • "off": No encoding of the response. You should not print the results directly on a web page without HTML-escaping the content first. (default)
exact boolean Query on exact name and keys only.
filter string

The filter parameter allows you to create more complex rules and constraints to apply to your query.

The filter value is a simple language that supports the following symbols:

  • the all, any, should and not operators
  • the type, domain, name, alias, with and without operands
  • the ( and ) parenthesis for grouping and precedence

To learn how to use the filter property see the Search Cookbook.

format string Structural format of the JSON response.

Acceptable values are:
  • "entity": Basic information about the entities. (default)
  • "ids": Ordered list of Freebase ids.
  • "mids": Ordered list of Freebase mids.
indent boolean Whether to indent the JSON results or not.
lang string The code of the language with which to run the query. Default is 'en'.
limit integer Maximum number of results to return. By default, 20 matches in decreasing order of relevance are returned, if that many exist. Fewer or more matches may be requested by using the limit parameter with a different value. (Example.)
mql_output string The MQL query to run againist the results to extract more data. After the query is run, the matching documents' IDs are passed to the mql_output MQL query to retrieve actual data about the matches. The MQL results are sorted by decreasing relevance score. 
prefixed boolean Prefix match against names and aliases.
query string Query term to search for.
scoring string Relevance scoring algorithm to use.

Acceptable values are:
  • "entity": Use Freebase and popularity entity ranking. (default)
  • "freebase": Use Freebase entity ranking.
  • "schema": Use schema ranking for properties and types.
spell string Request 'did you mean' suggestions

Acceptable values are:
  • "always": Request spelling suggestions for any query at least three characters long.
  • "no_results": Request spelling suggestions if no results were found.
  • "no_spelling": Don't request spelling suggestions. (default)
stemmed boolean Query on stemmed names and aliases. May not be used with prefixed.
type string Restrict to topics with this Freebase type id.
with string A filter rule to match against.
without string A filter rule to not match against.

Request body

Do not supply a request body with this method.

Response

If successful, the response is a JSON structure.

{
  "status":"200 OK",
  "result":[
    {
      "mid":"/m/0b1zz",
      "name":"Nirvana",
      "notable":{"name":"Record Producer","id":"/music/producer"},
      "score":55.227268
    },{
      "mid":"/m/05b3c",
      "name":"Nirvana",
      "notable":{"name":"Belief","id":"/religion/belief"},
      "score":44.248726
    },{
      "mid":"/m/01h89tx",
      "name":"Nirvana",
      "notable":{"name":"Musical Album","id":"/music/album"},
      "score":30.371510
    },{
      "mid":"/m/01rn9fm",
      "name":"Nirvana",
      "notable":{"name":"Musical Group","id":"/music/musical_group"},
      "score":30.092449
    },{
      "mid":"/m/02_6qh",
      "name":"Nirvana",
      "notable":{"name":"Film","id":"/film/film"},
      "score":29.003593
    },{
      "mid":"/m/01rkx5",
      "name":"Nirvana Sutra",
      "score":21.344824
    }
  ],
  "cost":10,
  "hits":0
}