How do I invoke a specific Google Custom Search refinement label?

Our organization currently uses the Google Custom Search system to provide automatic suggestions, and we have about 3 qualifying labels configured in our CSE. We used to use WebSearch and SearchControl, and WebSearch has a setSiteRestriction method that allows us to specifically select the refinement label: - http://code.google.com/apis/websearch/docs/reference.html#_class_GwebSearch

Previous code example:

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, , , case switch. , , , , , . !:)

+3
2

. :

var customSearchControl = new google.search.CustomSearchControl(cseId);
customSearchControl.setSearchStartingCallback(this, function(control, searcher, query) 
{
      searcher.setQueryAddition('more:' + refinement);
});
+1

customSearchControl .

a) , ('more:' + )

b) , , .

var customSearchOptions =
    { 'defaultToRefinement' : 'refinement_label_name' };

  var customSearchControl =
    new google.search.CustomSearchControl('YOUR_CSE_ID', customSearchOptions);

defaultToRefinement JavaScript API.

.

+3

All Articles