目前,我们的组织正在使用Google自定义搜索引擎提供自动建议,并且我们在我们的CSE中配置了大约3个精炼标签。以前,我们使用WebSearch和SearchControl,其中WebSearch有一个setSiteRestriction方法,允许我们特别选择一个精炼标签: - http://code.google.com/apis/websearch/docs/reference.html#_class_GwebSearch
以前的代码示例:
var searchControl = new google.search.SearchControl();
var webSearch = new google.search.WebSearch();
//Refinement allows us to tell Google which specific sites to search
var refinement="Support";
//filter custom search and currently there are 3 refinements
(some other variables declaration here including 'product')
switch(product)
{
case "10000":
refinement = "Support1";
break;
case "10200":
refinement = "Support1";
break;
case "10001":
refinement = "Support2";
break;
default:
break;
}
/*this is the code to fill in the custom search. The refinement was set above - either "Support", "Support1", or "Support2".*/
webSearch.setSiteRestriction('cseId', refinement);
......
目前,我们正在迁移到CustomSearchControl工具来替换已弃用的WebSearch,但显然我找不到任何方法来根据switch case语句的值特定选择一个细化标签。这里需要立即帮助,如果有相关文档可以指引给我将不胜感激。谢谢!:)