What does Google's Knowledge Graph API return as results for a lesser known search query?

576 views Asked by At

We are trying to integrate Google's Knowledge Graph with one of our applications, we found the Knowledge Graph very useful for Popular results, but were curious about the results for lesser known queries which do not have their graphs defined.

1

There are 1 answers

1
Bryan Dimas On BEST ANSWER

Based on my latest searches/my brief experience with it, most of the time Google's Knowledge Graph API returns empty results even though a simple Google search with the exact same query would have given me the result I'm looking for. This is what I mean by 'empty result' (when I search for 2014 Toyota Camry SE tire size), for example:

[16] pry(main)> response = HTTParty.get("https://kgsearch.googleapis.com/v1/entities:search?query=2014 Toyota Camry SE tire size&key=#{API_KEY}")
=> {"@context"=>
{"@vocab"=>"http://schema.org/",
"goog"=>"http://schema.googleapis.com/",
"EntitySearchResult"=>"goog:EntitySearchResult",
"detailedDescription"=>"goog:detailedDescription",
"kg"=>"http://g.co/kg"},
"@type"=>"ItemList",
"itemListElement"=>[]}

Other times it returns inaccurate results (not what I was looking for). In the following example I am searching for information about the 2014 Toyota Camry but instead all the results are appear as if I was searching for information related to the company

[4] pry(main)> response = HTTParty.get("https://kgsearch.googleapis.com/v1/entities:search?query=2014 toyota camry&key=#{API_KEY}")
=> {"@context"=>
  {"@vocab"=>"http://schema.org/",
   "goog"=>"http://schema.googleapis.com/",
   "EntitySearchResult"=>"goog:EntitySearchResult",
   "detailedDescription"=>"goog:detailedDescription",
   "resultScore"=>"goog:resultScore",
   "kg"=>"http://g.co/kg"},
 "@type"=>"ItemList",
 "itemListElement"=>
  [{"@type"=>"EntitySearchResult",
    "result"=>
     {"@id"=>"kg:/m/02qtntf",
      "name"=>"Toyota Kirloskar Motor",
      "@type"=>["Corporation", "Thing", "Organization"],
      "description"=>"Automotive industry company",
      "detailedDescription"=>
       {"articleBody"=>
         "Toyota Kirloskar Motor Pvt Ltd is a subsidiary of Toyota Motor Corporation of Japan, for the manufacture and sales of Toyota cars in India. It is currently the 4th largest car maker in India after Maruti Suzuki, Hyundai, and Mahindra.\n",
        "url"=>"https://en.wikipedia.org/wiki/Toyota_Kirloskar_Motor",
        "license"=>"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"},
      "url"=>"http://www.toyotabharat.com"}
...

I haven't yet gotten the results I'm looking for—even when I specify the type (ie. &types=Car).

I don't know why this is the case but it is.