Google Custom search api discrepancy in result

≯℡__Kan透↙ 提交于 2020-01-06 23:42:29

问题


I am first trying the standard web search, image below, which returns 476 results

I have the custom Google ruby api client and have the custom search engine and api key setup.

This is my query

client = Google::APIClient.new(application_name: 'Foo',
                                     application_version: 1,
                                     :authorization => nil)
        search = client.discovered_api('customsearch')
        result = client.execute(
            search.cse.list,
            'key' => 'xxxxx.xxxx_xxxxx_mykey',
            'q' => 'chateau palmer',
            'siteSearch' => 'nytimes.com',
            'siteSearchFilter' => 'i',
            'cx' => 'my_custom_Search key'
        )
        total =  result.data.queries.request.collect {|i| i['totalResults']}

The result i get are completely different in count, what can be the reason?


回答1:


This has been answered in another question and by Google.

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

  • Even if a custom search engine is configured to search the entire web, it’s designed to emphasize results from your own sites.
  • Your custom search engine doesn’t include Google Web Search features such as Oneboxes, real-time results, universal search, social feaures, or personalized results.
  • 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.

Also, of other note, there are a great deal of flags that you can set such as location and language that the web version determines which have to be set in your code when using the API.



来源:https://stackoverflow.com/questions/28489066/google-custom-search-api-discrepancy-in-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!