google 本地搜索参数设置
来源:互联网 发布:淘宝买快排配件需注意 编辑:程序博客网 时间:2024/06/08 12:03
For Flash developers, and those developers that have a need to access the Search API from other Non-Javascript environments, the API exposes a simple RESTful interface. In all cases, the method supported is Developers are also encouraged to make use of the Like the core Javascript interface, this interface is exposed through a uniform URL containing a mix of both standard and searcher specific CGI arguments. Your application can use an http stack of it's choosing. The only requirements are that you must be able to construct a properly constructed URL with all necessary CGI arguments, that you send an http referer header that accurately identifies your application, and that you are able to process the JSON encoded response. Each search endpoint is accessed through a standard URL. The following table lists the URL used to access each service. Each request contains a mix of standard URL arguments and an optional set of searcher specific arguments. This section describes the standard arguments that are uniform across all searchers and that convey virtually identical semantic information to each searcher. In some cases, an argument is optional. This is indicated with a The following table lists the standard URL arguments. Additional sections appear below that highlight searcher specific arguments. As discussed briefly in the previous section, there are two major variations in the response format. When the In the JSON fragment above, note that the By using the If the application supplies both The Web Search system supports a number of optional arguments which are all listed below:Flash and other Non-Javascript Environments
GET
and the response format is a JSON encoded result set with embedded status codes. Applications that use this interface must abide by all existing terms of service. An area to pay special attention to relates to correctly identifying yourself in your requests. Applications MUST always include a valid and accurate http referer header in their requests. In addition, we ask, but do not require, that each request contains a valid API Key. By providing a key, your application provides us with a secondary identification mechanism that is useful should we need to contact you in order to correct any problems. Read more about the usefulness of having an API keyuserip
parameter (see below) to supply the IP address of the end-user on whose behalf you are making the API request. Doing so will help distinguish this legitimate server-side traffic from traffic which doesn't come from an end-user.Standard URL Base Address'
Searcher Base Url Web Searchhttps://ajax.googleapis.com/ajax/services/search/webStandard URL Arguments
?
following the name of the argument. In all cases, the value of a CGI argument must be properly escaped (e.g., via the functional equivalent of Javascript'sencodeURIComponent()
method).Argument Example Description qq=Paris%20HiltonThis argument supplies the query, or search expression, that is passed into the searcher.vv=1.0This argument supplies protocol version number. The only valid value at this point in time is 1.0
.userip?userip=192.168.0.1This argument supplies the IP address of the end-user on whose behalf the request is being made. Requests that include it are less likely to be mistaken for abuse. In choosing to utilize this parameter, please be sure that you're in compliance with any local laws, including any laws relating to disclosure of personal information being sent.rsz?rsz=4This optional argument supplies the number of results that the application would like to recieve. Values can be any integer between 1
and 8
. Alternately, a value of small
indicates a small result set size or 4
results. A value of large
indicates a large result set or 8
results. Finally, for filter Custom Search Engines, a value of filtered_cse
will return 10
results. If this argument is not supplied, a value of small
is assumed.hl?hl=frThis optional argument supplies the host language of the application making the request. If this argument is not present then the system will choose a value based on the value of the Accept-Language
http header. If this header is not present, a value of en
is assumed.key?key=your-keyThis optional argument supplies the application's key. If specified, it must be a valid key associated with your site which is validated against the passed referer header. The advantage of supplying a key is so that we can identify and contact you should something go wrong with your application. Without a key, we will still take the same appropriate measures on our side, but we will not be able to contact you. It is definitely best for you to pass a key.start?start=4This optional argument supplies the start index of the first search result. Each successful response contains a cursor
object (see below) which includes an array of pages
. The start
property for a page may be used as a valid value for this argument. For reference, a sample cursor object is shown below:"cursor": { "pages": [ { "start": "0", "label": 1 }, { "start": "4", "label": 2 }, { "start": "8", "label": 3 }, { "start": "12","label": 4 } ], "estimatedResultCount": "48758", "currentPageIndex": 0, "moreResultsUrl": "http://www.google.com/search..."}
callback?callback=fooThis optional argument alters the standard response format. When supplied, instead of producing a simple JSON encoded object, the system produces a Javascript function call response where the value of callback
specifies the name of the function called in the response.callbackFunction( {"responseData" : { "results" : [], "cursor" : {} }, "responseDetails" : null | string-on-error, "responseStatus" : 200 | error-code});
context?context=barThis optional argument is related to the context
argument. When both are supplied, the value of context
alters the normal response format associated with callback
. The new format is:callbackFunction( contextValue, // the context arg value responseObject, // the collection of results and cursor responseStatus, // 200 on success, non-200 on failure errorDetails) // error string for non-200 response
Standard Response Format
callback
and context
arguments are not supplied, the response format is a simple JSON object:{ "responseData" : { "results" : [], "cursor" : {} }, "responseDetails" : null | string-on-error, "responseStatus" : 200 | error-code}
responseData
property contains a results
array and an optional cursor
. These are identical both semantically and structurally to the results returned through the JavaScript Searchers layer. The responseStatus
property contains a value of 200
on success and a non-200 http error status code on failure. If there is a failure, responseDetails
contains a diagnostic string.callback
argument, applications can easily request a JavaScript callback::callback({
"responseData" : {
"results" : [],
"cursor" : {}
},
"responseDetails" : null | string-on-error,
"responseStatus" : 200 | error-code
});callback
and context
arguments, the response is encoded as a JavaScript procedure call. In this mode of operation, the value ofcallback
becomes the procedure call target, the value of context
is passes as the first argument, the value of responseData
from above is passes as the second argument, the response status is passed as the third argument, and the final argument is either null
or a diagnostic string.foo('bar',{
"results": [
{
"GsearchResultClass": "GwebSearch",
"unescapedUrl": "http://en.wikipedia.org/wiki/Paris_Hilton",
"url": "http://en.wikipedia.org/wiki/Paris_Hilton",
"visibleUrl": "en.wikipedia.org",
"cacheUrl": "http://www.google.com/search?q/u003dcache:TwrPfhd22hYJ:en.wikipedia.org",
"title": "/u003cb/u003eParis Hilton/u003c/b/u003e - Wikipedia, the free encyclopedia",
"titleNoFormatting": "Paris Hilton - Wikipedia, the free encyclopedia",
"content": "In 2006, she released her debut album /u003cb/u003eParis/u003c/b/u003e..."
},
{
"GsearchResultClass": "GwebSearch",
"unescapedUrl": "http://www.imdb.com/name/nm0385296/",
"url": "http://www.imdb.com/name/nm0385296/",
"visibleUrl": "www.imdb.com",
"cacheUrl": "http://www.google.com/search?q/u003dcache:1i34KkqnsooJ:www.imdb.com",
"title": "/u003cb/u003eParis Hilton/u003c/b/u003e",
"titleNoFormatting": "Paris Hilton",
"content": "Self: Zoolander. Socialite /u003cb/u003eParis Hilton/u003c/b/u003e was..."
},
...
],
"cursor": {
"pages": [
{ "start": "0", "label": 1 },
{ "start": "4", "label": 2 },
{ "start": "8", "label": 3 },
{ "start": "12","label": 4 }
],
"estimatedResultCount": "59600000",
"currentPageIndex": 0,
"moreResultsUrl": "http://www.google.com/search?oe/u003dutf8..."
}
}
, 200, null)Web Search Specific Arguments
Argument Description cx?This optional argument supplies the unique id for the Custom Search Engine that should be used for this request (e.g.,cx=000455696194071821846:reviews
).cref?This optional argument supplies the url of a linked Custom Search Engine specification that should be used to satisfy this request (e.g.,cref=http%3A%2F%2Fwww.google.com%2Fcse%2Fsamples%2Fvegetarian.xml
).safe?This optional argument supplies the search safety level which may be one of:
lr?This optional argument allows the caller to restrict the search to documents written in a particular language (e.g., safe=active
- enables the highest level of safe search filteringsafe=moderate
- enables moderate safe search filtering (default)safe=off
- disables safe search filteringlr=lang_ja
). This list contains the permissible set of values.filter?New!This optional argument controls turning on or off the duplicate content filter:
gl? New!This optional argument allows the caller to tailor the results to a specific country. The value should be a valid country code (e.g. filter=0
- Turns off the duplicate content filterfilter=1
- Turns on the duplicate content filter (default)uk
, de
, etc.). If this argument is not present, then the system will use a value based on the domain used to load the API (e.g. https://www.google.com/jsapi). If the API loader was not used, a value of "us" is assumed.Searcher and Drawing Options
- google 本地搜索参数设置
- GOOGLE本地搜索
- Google本地搜索
- jQuery运用Google Search API搜索结果保存到本地
- Google Chrome 新手入门 相关参数设置
- google搜索
- google搜索
- google搜索
- Google搜索
- google搜索
- google搜索
- GOOGLE搜索
- google搜索
- Google搜索
- google搜索
- google搜索
- google搜索
- Google 搜索
- 细化匹配—lhMorpThinFit
- 20110509银行业务调度系统
- VBScript的PDF转换工具.5.辅助函数:路径
- Tomcat无法启动,报错java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
- 单链表的各种操作
- google 本地搜索参数设置
- 天气预报网址收藏
- 使用Dom4j读取xml文件
- /usr/include/bits/types.h和pthreadtypes.h
- Servlet 3.0新特性——文件上传接口
- C#基础之集合(Collection)
- 与在MFC中使用Media Player控件有关的资料
- 测试用
- 大连市中考数学试题分析