结果中的Google Custom Search API差异 [英] Google Custom search api discrepancy in result
问题描述
我首先尝试使用标准的网络搜索(如下图),该搜索将返回 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 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屋!