From cc13f792dded874575713ce33d83831375c79d60 Mon Sep 17 00:00:00 2001 From: Kevin Abel <kabel2@unl.edu> Date: Thu, 18 Aug 2011 18:33:52 +0000 Subject: [PATCH] Added a hack that works around a bug in the google API that prevents the use of linked CSE's via the {crefUrl: ""} in the CustomSearchControl constructor. The hack uses API calls that are part of the depricated search API, but it appears to restore functionality. --- www/searchFunc.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/www/searchFunc.js b/www/searchFunc.js index 7b6efd4..dca5418 100644 --- a/www/searchFunc.js +++ b/www/searchFunc.js @@ -33,6 +33,11 @@ function searchInit() { if (UNL_Search.do_local_search) { var local_search = new google.search.CustomSearchControl(UNL_Search.local_search_context); + // WARNING: The following code is an undocumented method of the Google API + // and appears to be on the deprication list, but it fixes a MAJOR bug in + // that prevents the use of linked CSE's + local_search.getWebSearcher().setSiteRestriction(UNL_Search.local_search_context); + // end hack local_search.setResultSetSize('small'); local_search.setSearchCompleteCallback(UNL_Search, UNL_Search.onSearchComplete); local_search.draw('local_results', drawOp); -- GitLab