bubble的备忘录

本blog主要用于常用资料的备忘、备份、备搜索

显示标签为“阅读笔记”的博文。显示所有博文
显示标签为“阅读笔记”的博文。显示所有博文

阅读笔记 Google Example Code:Linked Custom Search Engines

地址:http://www.google.com/uds/samples/cse/cref.html

This sample demonstrates the latest addition to Custom Search Engines, the Linked Custom Search Engine. You will note that we use an object for site and in the crefUrl property we supply the url of a Custom Search Engine definition file.

Vegan CSE - powered by The Google AJAX Search API and Google Custom Search Engines

结论:针对个性化搜索引擎进行搜索,包括左右两个搜索控件
通过直接使用个性化搜索引擎的站点限定XML文件作为限定站点的输入
左边是针对整个个性化搜索引擎进行搜索
右边是针对个性化搜索引擎下的一个标签进行搜索

存疑:无

可用代码:
var crefUrl = "http://www.google.com/cse/samples/vegetarian.xml";
searcher = new google.search.WebSearch();
searcher.setSiteRestriction({crefUrl : crefUrl});//限定站点使用个性化搜索引擎,为限定标签
searcher.setUserDefinedLabel("Vegan CSE");

阅读笔记 Google Example Code:Custom Search Engine Refinements

地址:http://www.google.com/uds/samples/cse/csearch.html
This sample builds on the sample above by introducing custom search engine refinements. You will note in the calls to setSiteRestriction() for the right hand side searcher, the code is using the opt_refinement argument to further restrict the search results within the custom search engine.

Curriculum Search Sample - powered by The Google AJAX Search API and Google Custom Search Engines

结论:主要针对一个个性化的搜索引擎进行搜索,包括左右两边两个搜索控件
左边的搜索控件针对整个个性化搜索引擎进行搜索,设置了more results 之后的页面样式
右边的搜索引擎包括六个搜索控件,前三个是对个性化搜索引擎的标签限定

存疑:无

可用代码:
google.search.WebSearch控件下的
.setSiteRestriction(site, opt_refinement, opt_moreResultsTemplate)
site:可以针对限定站点,个性化的搜索引擎
opt_refinement:针对个性化搜索引擎,可以进一步限定到一个标签子集
opt_moreResultsTemplate:可以指定按下more results链接后的页面样式模板

阅读笔记 Google Example Code:Custom Search Engines

地址:http://www.google.com/uds/samples/cse/index.html
This sample builds on the sample above by making heavy use of a product review custom search engine. Note the various calls to setSiteRestriction() all being made using a custom search engine id. The sample includes some other concepts that are not related to site restriction. These include the use of the GSearchForm object that is used to drive multiple search controls and the use of custom CSS directives that restyle portions of the search control and results.

结论:
通过cse类,同时设立了两个搜索结果框,以及最上边一个搜索输入框,和最下边一个视频搜索结果框
搜索输入框调用了searchForm控件
左右搜索结果框调用了searchControl控件,并预设了结果集大小,其中,右边同时设立了六个搜索引擎,采用标签的形式对结果分类
视频搜索结果框使用了GSvideoBar控件,可以同时实现视频搜索和选择结果播放的功能,需要在HTML页面中预设两个div用于分别显示搜索结果框和视频播放框

存疑:无

阅读笔记 Google Example Code:Site Restricted Search

地址:http://www.google.com/uds/samples/apidocs/sitesearch.html
This sample demonstrates how to use the setSiteRestriction() method of the GwebSearch, GblogSearch, and GnewsSearch objects. When doing site restricted search, it is often a good idea to specify a customized label for the search result section header, and in some cases, perform some custom styling of the search results. Both of these functions are supported by using the setUserDefinedLabel() and setUserDefinedClassSuffix() methods.

结论:本例子在搜索中执行了限定站点搜索,并调用了定制的个性化搜索引擎,可以用这种方式在我们的搜索引擎中先搜索我们自己的站点,在通过调用我们定制的个性化搜索引擎实现我们想要的搜索功能。

存疑:为了什么每个搜索控件的结果都默认只返回一个搜索结果?虽然在搜索结果框中,每个搜索控件都对应了一个搜索结果框,并提供了选择按键,可以选择显示一个结果,多个结果和所有结果,但为什么默认只显示了一个结果?

可用注释:
google.load('search', '1');
//google.load(moduleName, moduleVersion, optionalSettings)该方法可以加载各个 AJAX API
//moduleName 是 API 的名称(例如 "maps" 或 "search")
//version 可以指定 API 模块的版本
//optionalSettings 可以为您作为 JavaScript 对象常量加载的 API 指定所有可选配置选项
Google AJAX Search API 可用参数
name: search
versions: 1
load request: google.load("search", "1");
supported options: callback, language, nocss
# callback: The function to call once the script has loaded. 后退控件
# language: The language in which to localize the API or API's UI controls. This is specified as a ISO639 language code. 语言设置
# nocss: A boolean that tells the API whether to load any style sheets typically associated with its controls. A developer might set this to false if he was completely overriding all of the loaded CSS and wanted to avoid the unnecessary load. 呈现样式
Eg.:google.load("maps", "2", {"language" : "ja_JP"});
Eg.:google.load("feeds", "1", {"nocss" : true});