目前,我們的組織正在使用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