结果中的Google Custom Search API差异 [英] Google Custom search api discrepancy in result

查看:106
本文介绍了结果中的Google Custom Search API差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我首先尝试使用标准的网络搜索(如下图),该搜索将返回 476 个结果

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

我有一个自定义的 Google ruby​​ api客户端,并且有自定义搜索引擎和api键设置.

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

这是我的查询

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?

推荐答案

已在另一个问题 Google.

您的结果不太可能与Google Web返回的结果相匹配 出于多种原因进行搜索:

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

  • 即使将自定义搜索引擎配置为搜索整个网络, 它旨在强调您自己网站的结果.
  • 您的自定义搜索引擎不包含Google Web搜索功能,例如 单一框,实时结果,通用搜索,社交功能或 个性化的结果.
  • 如果您的自定义搜索引擎包含的内容超过 十个网站,结果可能来自我们索引的一个子集,并且可能 与Google.com上网站:"搜索的结果不同.
  • 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.

还有一点需要注意的是,您可以设置很多标志,例如位置和语言,网络版本决定了在使用API​​时必须在代码中设置的位置和语言.

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.

这篇关于结果中的Google Custom Search API差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆