目前,我们的组织正在使用Google自定义搜索引擎来提供自动建议,并且我们在CSE中配置了大约3个优化标签。以前,我们使用网络搜索和SearchControl,以及网页搜索有着setSiteRestriction方法,使我们能够明确选择优化标签: - http://code.google.com/apis/websearch/docs/reference.html#_class_GwebSearch如何触发特定的Google自定义搜索引擎优化标签?
前面的代码示例:
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语句的值专门选择优化标签。在这里需要立即的帮助,如果有相关的文档,你们可以指点我会非常感激。谢谢! :)
这几乎是* *工作......你可以做到这一点,或只是做 customSearchControl.execute(yourQuery +“更多:” +精) 但是,它并不突出细化标签告诉用户什么你代表他们做了。调查,也许我会提交一个错误。 – 2011-06-19 18:59:52