aaronstacy
aaronstacy

Reputation: 6428

Google API returning different results than website

When I do a site-specific search on google.com:

site:http://one-month-of-chat-logs.github.io security

I get 12 results. I signed up for a custom search engine (cx: 015271449006306103053:mz6wkimeenc) and API key, and I get only 3 results when I run the same search:

$ curl 'https://www.googleapis.com/customsearch/v1?key=$MY_API_KEY&cx=015271449006306103053%3Amz6wkimeenc&q=security'

Why do the results differ? Is my API request actually querying something different than the search I performed on google.com?

Upvotes: 7

Views: 6171

Answers (2)

melchi
melchi

Reputation: 667

I found that it is impossible to get the right results using Google APIs. Even if the search is only for one website, their search results are different if you use their UI vs use the API and pay for it. This is I guess, because google makes more money if they can show ads, while APIs are definitely only a face saving measure.

Since some of you are ok with a paid solution(@ihsan) you can try using a third party service like https://www.expertrec.com where you can control your crawl (so crawl depth is not a problem), ranking (adjust it the way you like), use the API or the full solution, with out any ads.

Upvotes: 1

Michael
Michael

Reputation: 433

This google page has what you are looking for https://support.google.com/customsearch/answer/70392?hl=en

your results are unlikely to match those returned by Google Web Search, for several reasons:

  1. Even if a custom search engine is configured to search the entire web, it’s designed to emphasize results from your own sites.
  2. Your custom search engine doesn’t include Google Web Search features such as Oneboxes, real-time results, universal search, social feaures, or personalized results.
  3. If your custom search engine includes more than ten sites, the results may be from a subset of our index and may differ from the results of a 'site:' search on Google.com.

Upvotes: 8

Related Questions